Module: beautiful
Key+value based theme library and associated utility modules.
Info:
- Copyright: 2008-2009 Damien Leone, Julien Danjou
-
Originally authored by: Damien Leone <[email protected]>,Julien Danjou <[email protected]>
(Full contributors list available on our github project)
Static module functions
| beautiful.gtk.get_theme_variables () -> table | Get GTK+3 theme variables from GtkStyleContext | |
| beautiful.get_font (name) -> lgi.Pango.FontDescription | Get a font description. | |
| beautiful.get_merged_font (name, merge) -> lgi.Pango.FontDescription | Get a new font with merged attributes, based on another one. | |
| beautiful.get_font_height (name) -> number | Get the height of a font. | |
| beautiful.init (config) -> true or nil | Function that initializes the theme settings. | |
| beautiful.get () -> table | Get the current theme. | |
| beautiful.theme_assets.taglist_squares_sel (size, fg) -> () | Generate selected taglist square. | |
| beautiful.theme_assets.taglist_squares_unsel (size, fg) -> () | Generate unselected taglist square. | |
| beautiful.theme_assets.gen_awesome_name (cr, height, bg, fg, alt_fg) | Put Awesome WM name onto cairo surface. | |
| beautiful.theme_assets.gen_logo (cr, width, height, bg, fg) | Put Awesome WM logo onto cairo surface. | |
| beautiful.theme_assets.awesome_icon (size, bg, fg) -> () | Generate Awesome WM logo. | |
| beautiful.theme_assets.wallpaper (bg, fg, alt_fg, s) -> () | Generate Awesome WM wallpaper. | |
| beautiful.theme_assets.recolor_titlebar (theme, color, state, postfix, toggle_state) -> table | Recolor titlebar icons. | |
| beautiful.theme_assets.recolor_layout (theme, color) -> table | Recolor layout icons. | |
| beautiful.xresources.get_current_theme () -> table | Get current base colorscheme from xrdb. | |
| beautiful.xresources.set_dpi (dpi, s) | Set DPI for a given screen (defaults to global). | |
| beautiful.xresources.apply_dpi (size, s) -> integer | Compute resulting size applying current DPI value (optionally per screen). |
Theme variables
| beautiful.font | string | The default font. | |
| beautiful.bg_normal | color | The default background color. | |
| beautiful.bg_focus | color | The default focused element background color. | |
| beautiful.bg_urgent | color | The default urgent element background color. | |
| beautiful.bg_minimize | color | The default minimized element background color. | |
| beautiful.fg_normal | color | The default focused element foreground (text) color. | |
| beautiful.fg_focus | color | The default focused element foreground (text) color. | |
| beautiful.fg_urgent | color | The default urgent element foreground (text) color. | |
| beautiful.fg_minimize | color | The default minimized element foreground (text) color. | |
| beautiful.wallpaper | string or gears.surface | The wallpaper path. | |
| beautiful.icon_theme | string | The icon theme name. | |
| beautiful.awesome_icon | string or gears.surface | The Awesome icon path. |
Deprecated functions
| beautiful.recolor_titlebar_normal (theme, color) | Recolor unfocused titlebar icons. | Deprecated |
| beautiful.recolor_titlebar_focus (theme, color) | Recolor focused titlebar icons. | Deprecated |
| beautiful.xresources.get_dpi (s) | Get global or per-screen DPI value falling back to xrdb. | Deprecated |
Fields
| beautiful.theme_path | string | The current theme path (if any) |
Static module functions
- 🔗 beautiful.gtk.get_theme_variables () -> table
-
Get GTK+3 theme variables from GtkStyleContext
Returns:
-
table
Key-value table with the following structure:
Result key StyleContext key StyleContext fallback #1 StyleContext fallback #2 GTK Widget fallback font_sizeLabel font-size font_familyLabel font-family bg_colortheme_bg_colorWindow bg fg_colortheme_fg_colorWindow fg base_colortheme_base_colorEntry bg text_colortheme_text_colorEntry fg button_bg_colortheme_button_bg_colortheme_bg_colorButton bg button_fg_colortheme_button_fg_colortheme_fg_colorButton fg button_border_colorButton border-color button_border_radiusButton border-radius button_border_widthButton border-top-width selected_bg_colortheme_selected_bg_colorToggleButton bg selected_fg_colortheme_selected_fg_colorToggleButton fg menubar_bg_colormenubar_bg_colortheme_bg_colorHeaderBar bg menubar_fg_colormenubar_fg_colortheme_fg_colorHeaderBar fg header_button_bg_colorheader_button_bg_colormenubar_bg_colortheme_bg_colorHeaderBar > Button bg header_button_fg_colorheader_button_fg_colormenubar_fg_colortheme_fg_colorHeaderBar > Button fg header_button_border_colorHeaderBar > Button border-color error_colorerror_colorerror_bg_colordestructive Button bg error_bg_colorerror_bg_colorerror_colordestructive Button bg error_fg_colorerror_fg_colortheme_selected_fg_colordestructive Button fg warning_colorwarning_colorwarning_bg_colorwarning_bg_colorwarning_bg_colorwarning_colorwarning_fg_colorwarning_fg_colortheme_selected_fg_colorsuccess_colorsuccess_colorsuccess_bg_colorsuccess_bg_colorsuccess_bg_colorsuccess_colorsuccess_fg_colorsuccess_fg_colortheme_selected_fg_colortooltip_bg_colortheme_tooltip_bg_colortheme_bg_colortooltip_fg_colortheme_tooltip_fg_colortheme_fg_colorosd_bg_colorosd_bgtheme_tooltip_bg_colortheme_bg_colorosd_fg_colorosd_fgtheme_tooltip_fg_colortheme_fg_colorosd_border_colorosd_borders_colorosd_fg_colorwm_bg_colorwm_bgmenubar_bg_colortheme_bg_colorHeaderBar bg wm_border_focused_colorwm_border_focusedtheme_selected_bg_colorToggleButton bg wm_border_unfocused_colorwm_border_unfocusedwm_bordermenubar_bg_colorHeaderBar bg wm_title_focused_colorwm_title_focusedwm_titletheme_selected_fg_colorToggleButton fg wm_title_unfocused_colorwm_title_unfocusedwm_unfocused_titlemenubar_fg_colorHeaderBar fg wm_icons_focused_colorwm_icons_focusedwm_title_focusedtheme_selected_fg_colorToggleButton fg wm_icons_unfocused_colorwm_icons_unfocusedwm_title_unfocusedmenubar_fg_colorHeaderBar fg - 🔗 beautiful.get_font (name) -> lgi.Pango.FontDescription
-
Get a font description.
See https://developer.gnome.org/pango/stable/pango-Fonts.html#PangoFontDescription.
Parameters:
Name Type(s) Description name string or lgi.Pango.FontDescription The name of the font. Returns:
-
lgi.Pango.FontDescription
- 🔗 beautiful.get_merged_font (name, merge) -> lgi.Pango.FontDescription
-
Get a new font with merged attributes, based on another one.
See https://developer.gnome.org/pango/stable/pango-Fonts.html#pango-font-description-from-string.
Parameters:
Name Type(s) Description name string or Pango.FontDescription The base font. merge string Attributes that should be merged, e.g. "bold". Returns:
-
lgi.Pango.FontDescription
- 🔗 beautiful.get_font_height (name) -> number
-
Get the height of a font.
Parameters:
Name Type(s) Description name string Name of the font. Returns:
-
number
The font height.
- 🔗 beautiful.init (config) -> true or nil
-
Function that initializes the theme settings. Should be run at the beginning of the awesome configuration file (normally rc.lua).
Example usages:
-- Using a table beautiful.init({font = 'Monospace Bold 10'}) -- From a config file beautiful.init("<path>/theme.lua")Example "
/theme.lua" (see 05-awesomerc.md:Variable_definitions): theme = {} theme.font = 'Monospace Bold 10' return themeExample using the return value:
local beautiful = require("beautiful") if not beautiful.init("<path>/theme.lua") then beautiful.init("<path>/.last.theme.lua") -- a known good fallback endParameters:
Name Type(s) Description config string or table The theme to load. It can be either the path to the theme file (which should return a table) or directly a table containing all the theme values. Returns:
-
true or nil
True if successful, nil in case of error.
- 🔗 beautiful.get () -> table
-
Get the current theme.
Returns:
-
table
The current theme table.
- 🔗 beautiful.theme_assets.taglist_squares_sel (size, fg) -> ()
-
Generate selected taglist square.
Parameters:
Name Type(s) Description size number Size. fg color Background color. Returns:
-
Image with the square.
- 🔗 beautiful.theme_assets.taglist_squares_unsel (size, fg) -> ()
-
Generate unselected taglist square.
Parameters:
Name Type(s) Description size number Size. fg color Background color. Returns:
-
Image with the square.
- 🔗 beautiful.theme_assets.gen_awesome_name (cr, height, bg, fg, alt_fg)
-
Put Awesome WM name onto cairo surface.
Parameters:
Name Type(s) Description cr Cairo surface. height number Height. bg color Background color. fg color Main foreground color. alt_fg color Accent foreground color. - 🔗 beautiful.theme_assets.gen_logo (cr, width, height, bg, fg)
-
Put Awesome WM logo onto cairo surface.
Parameters:
Name Type(s) Description cr Cairo surface. width number Width. height number Height. bg color Background color. fg color Foreground color. - 🔗 beautiful.theme_assets.awesome_icon (size, bg, fg) -> ()
-
Generate Awesome WM logo.
Parameters:
Name Type(s) Description size number Size. bg color Background color. fg color Background color. Returns:
-
Image with the logo.
- 🔗 beautiful.theme_assets.wallpaper (bg, fg, alt_fg, s) -> ()
-
Generate Awesome WM wallpaper.
Parameters:
Name Type(s) Description bg color Background color. fg color Main foreground color. alt_fg color Accent foreground color. s screen Screen (to get wallpaper size). Returns:
-
Wallpaper image.
- 🔗 beautiful.theme_assets.recolor_titlebar (theme, color, state, postfix, toggle_state) -> table
-
Recolor titlebar icons.
Parameters:
Name Type(s) Description theme table Beautiful theme table. color color Icons' color. state string "normal"or"focus".postfix string nil,"hover"or"press".toggle_state string nil,"active"or"inactive".Returns:
-
table
Beautiful theme table with the images recolored.
- 🔗 beautiful.theme_assets.recolor_layout (theme, color) -> table
-
Recolor layout icons.
Parameters:
Name Type(s) Description theme table Beautiful theme table color color Icons' color. Returns:
-
table
Beautiful theme table with the images recolored.
- 🔗 beautiful.xresources.get_current_theme () -> table
-
Get current base colorscheme from xrdb.
Returns:
-
table
Color table with keys 'background', 'foreground' and 'color0'..'color15'.
- 🔗 beautiful.xresources.set_dpi (dpi, s)
-
Set DPI for a given screen (defaults to global).
Parameters:
Name Type(s) Description dpi number DPI value. s Optional integer Screen. - 🔗 beautiful.xresources.apply_dpi (size, s) -> integer
-
Compute resulting size applying current DPI value (optionally per screen).
Parameters:
Name Type(s) Description size number Size s Optional integer or screen The screen. Returns:
-
integer
Resulting size (rounded to integer).
Theme variables
- 🔗 beautiful.font string
-
The default font.
Click to display more Used by:
styleA table with values to override each `beautiful.notification_action` values.- naughty.notification Create a notification.
- naughty.notification Create a notification.
- font Set a textbox font.
- font Set a textbox font.
- font Set a textbox font.
- 🔗 beautiful.bg_normal color
-
The default background color.
The background color can be transparent. If there is a compositing manager such as compton, then it will be real transparency and may include blur (provided by the compositor). When there is no compositor, it will take a picture of the wallpaper and blend it.
Click to display more Used by:
awful.widget.hotkeys_popup.widget.newCreate an instance of widget with hotkeys help.- awful.widget.prompt Create a prompt widget which will launch a command.
- awful.widget.prompt Create a prompt widget which will launch a command.
- awful.widget.prompt Create a prompt widget which will launch a command.
bgThe background of the wibox.bgThe background of the wibox.bgThe background of the wibox.
- 🔗 beautiful.bg_focus color
-
The default focused element background color.
Click to display more Used by:
- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- 🔗 beautiful.bg_urgent color
-
The default urgent element background color.
Click to display more Used by:
- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
urgentSet to `true` when the client ask for attention.
- 🔗 beautiful.bg_minimize color
-
The default minimized element background color.
Click to display more Used by:
- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
- 🔗 beautiful.fg_normal color
-
The default focused element foreground (text) color.
Click to display more Used by:
awful.widget.hotkeys_popup.widget.newCreate an instance of widget with hotkeys help.border_colorThe border color.border_colorThe border color.- awful.widget.prompt Create a prompt widget which will launch a command.
- awful.widget.prompt Create a prompt widget which will launch a command.
- awful.widget.prompt Create a prompt widget which will launch a command.
border_colorBorder color.border_colorBorder color.fgThe foreground (text) of the wibox.fgThe foreground (text) of the wibox.fgThe foreground (text) of the wibox.border_colorSet the color for the border.shape_border_colorWhen a `shape` is set, also draw a border.
- 🔗 beautiful.fg_focus color
-
The default focused element foreground (text) color.
Click to display more Used by:
- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
- naughty.notification Create a notification.
- naughty.notification Create a notification.
- 🔗 beautiful.fg_urgent color
-
The default urgent element foreground (text) color.
Click to display more Used by:
- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
urgentSet to `true` when the client ask for attention.
- 🔗 beautiful.fg_minimize color
-
The default minimized element foreground (text) color.
Click to display more Used by:
awful.widget.hotkeys_popup.widget.newCreate an instance of widget with hotkeys help.- awful.widget.tasklist Create a new tasklist widget.
- awful.widget.tasklist Create a new tasklist widget.
- 🔗 beautiful.wallpaper string or gears.surface
-
The wallpaper path.
Click to display more Used by:
- rc.lua The default rc.lua file.
- 🔗 beautiful.icon_theme string
-
The icon theme name.
It has to be a directory in
/usr/share/iconsor an XDG icon folder.
Click to display more Used by:
- menubar.icon_theme.new Class constructor of `icon_theme`
- 🔗 beautiful.awesome_icon string or gears.surface
-
The Awesome icon path.
Click to display more Used by:
- rc.lua The default rc.lua file.
Deprecated functions
- 🔗 beautiful.recolor_titlebar_normal (theme, color)
-
Recolor unfocused titlebar icons.
This method is deprecated. Use a beautiful.theme_assets.recolor_titlebar.
Parameters:
Name Type(s) Description theme table Beautiful theme table color color Icons' color. Returns:
-
table
Beautiful theme table with the images recolored.
- 🔗 beautiful.recolor_titlebar_focus (theme, color)
-
Recolor focused titlebar icons.
This method is deprecated. Use a beautiful.theme_assets.recolor_titlebar.
Parameters:
Name Type(s) Description theme table Beautiful theme table color color Icons' color. Returns:
-
table
Beautiful theme table with the images recolored.
- 🔗 beautiful.xresources.get_dpi (s)
-
Get global or per-screen DPI value falling back to xrdb.
This function is deprecated. Use
s.dpiand avoid getting the DPI without a screen.Parameters:
Name Type(s) Description s Optional integer or screen The screen. Returns:
-
number
DPI value.
Fields
- 🔗 beautiful.theme_path string
- The current theme path (if any)