awesome/themes/carbon/theme.lua

424 lines
16 KiB
Lua

-- Carbon: the reference theme
-- This theme is designed as a reference for working with AWMTK.
-- Comments will go into some detail about the features of AWMTK,
-- such as contexts, elements, and element prototypes.
--[[
- Preface
AWMTK is a library for building widget style contexts.
Essentially, it's an easy way to separate styles for each individual
widget by creating a "context" that contains variables for that
specific widget, which are set to fall back to the broader
definitions of these variables.
Take as an example a specific variable definition:
`theme.context_button_bg_normal`
If this variable doesn't exist, it defaults to the broader variable
`theme.button_bg_normal`
which itself defaults to an even broader variable
`theme.bg_normal`
That way, a theme can be as specific as possible without requiring
]]
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local wibox = require("wibox")
local dpi = xresources.apply_dpi
local theme = {}
-- {{{ Color definitions
-- These variables define a fallback state for all widgets to use.
theme.font = "sans 10"
theme.name = "carbon"
theme.bg_normal = "#19191D"
theme.bg_focus = "#3E3E3E"
theme.bg_urgent = "#5E5E5E"
theme.bg_minimize = "#5E5E5E"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#e1dec7"
theme.fg_focus = "#e1dec7"
theme.fg_urgent = "#e1dec7"
theme.fg_minimize = "#e1dec7"
theme.useless_gap = dpi(10)
theme.border_width = dpi(1)
theme.border_normal = theme.bg_normal
theme.border_focus = theme.bg_focus
theme.border_marked = theme.bg_marked
-- include generic boilerplate
theme = require("themes.generic")(theme)
-- }}}
-- All of the previous variables are still avaialable.
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- tasklist_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- notification_font
-- not1ification_[bg|fg]
-- notification_[width|height|margin]
-- notification_[border_color|border_width|shape|opacity]
-- etc.
-- {{{ Elements
--[[
All AWMTK widgets have various elements with their own variables.
These elements are essentially primitive UI components.
The following elements are defined:
- container
- button
- inputbox
- textbox
- icon
The variables for these elements can be accessed in the form
theme.{context}_{broader definition}
i.e.
theme.button_bg_normal ("button" is context, "bg_normal" is a broader
definition)
]]
theme.button_bg_normal = theme.bg_normal
theme.button_bg_focus = theme.bg_focus
theme.button_bg_urgent = theme.bg_urgent
theme.button_bg_marked = theme.bg_marked
--[[ ...etc
In total, we can define the available primitive variables as such:
[button|container|inputbox|textbox|icon]_...
...[bg|fg|border]_[normal|focus|urgent|marked],
...shape_border_[width|color],
...inner_margin,
...rounding
These variables are pretty self descriptive,
Additionally, we have some variables for the container element:
container_spacing
container_spacing_vertical
container_spacing_horizontal
These variables control the spacing of widgets in various layouts.
]]
-- {{{ Bars
-- Sometimes objects require additional variables that don't fall under the
-- primitives model. For example, in this particular case, unitybar has a
-- "unitybar_bg" variable, which does not belong to any of the primitives but to
-- the bar itself. Ideally, all of the variables like these will be documented
-- in the widgets documentation.
-- All of the following variables do not belong to any primitive:
theme.unitybar_bg = theme.bg_normal.."AA"
theme.unitybar_border_color = theme.bg_normal
theme.unitybar_width = dpi(50)
theme.unitybar_inner_margin = 3
--Titlebars
theme.titlebar_bg_normal = {
type = "linear",
from = {0,0},
to = {0,15},
stops = {
{0,theme.bg_normal},
{1,"#14141A"},
}
}
theme.titlebar_bg_focus = {
type = "linear",
from = {0,0},
to = {0,15},
stops = {
{0,theme.bg_focus},
{1,"#333333"}
}
}
-- Top bar
theme.topbar_bg = theme.titlebar_bg_normal
-- }}}
-- {{{ Widgets
--[[
All of the widgets written in this config have contexts.
A context essentially contains values for primitves that are specific
to the widget. Think of the context as of a namespace but for that
particular widget's style variables.
In practice, that means that defining
`theme.menu_button_bg_normal`
will NOT affect
`theme.button_bg_normal`
and therefore all of the other instances derived from it, i.e.
`theme.drawer_button_bg_normal`
Do note however that if `theme.menu_button_bg_normal` is not defined,
defining `theme.button_bg_normal` WILL affect it, as it is derived
from `theme.button_bg_normal`
An additional note should be made about the fact that these variables
affect every instance of the widget, i.e. if you have a battery
widget in a wibar and another battery widget on the lock screen,
both will be affected by the definiton of
`theme.batter_container_bg_normal`. To change a particular widget's
style properties, use the `style` table in its arguments table. (It should also be noted that `style` table has higher priority then theme variables)
i.e. in .../awesome/core/layout.lua
```
require("widget.drawer")({ --This creates an instance of a widget
style = {
--This variable affects only this particular instance
button_bg_normal = "#FF00FF"
}
})
```
]]
--Example: defining menu properties
theme.menu_submenu_icon = global.themes_dir..theme.name.."/submenu.png"
theme.menu_height = dpi(18)
theme.menu_width = dpi(140)
--`button` is any clickable/hoverable element of the menu
theme.menu_button_height = dpi(18)
theme.menu_button_rounding = 5
theme.menu_button_inner_margin = 2
--`container` is the background of the menu
theme.menu_container_spacing = 4
theme.menu_container_rounding = 5
--`icon` is any of the small power icons in the menu
--because `menu` applies generally to all of the menus,
--including the popup menus that appear when you click on an icon
--of the window, these particular icons have their own namespace.
--(to be completely honest i'm not exactly proud of how this works)
theme.powercontrol_icon_rounding = 5
-- Calculate height/width of the button
local button_size = theme.unitybar_width - theme.unitybar_inner_margin*2
-- All of the basic elements (container, button, icon, etc.) have a template. A
-- template defines the generic geometry properties of the given element. It's
-- possible to override these templates (even on a per-widget basis, as shown
-- here).
-- Disclaimer: This particular feature was mostly developed as an afterthought,
-- and it might change in the future to provide a more flexible approach to
-- handling events. Use at your own risk and only if you know what you're doing
-- or at the very least have some understanding of AwesomeWM's wibox library.
-- Example: this templates overrides the template of the container for all menus
-- in such a way that all of them will contain a gradient bar and a border
-- (awful.popup isn't capable of gradient borders, but using two backgroudnds
-- it's possible to make it work)
theme.menu_container_widget = function(style)
return {
{
{
{
{
{
-- (weirdly enough i can't just set forced_height
-- for the container itself.)
{
widget = wibox.widget.textbox,
forced_height = 8
},
widget = wibox.container.background,
bg = {
type = "linear",
from = {0,0},
to = {0,8},
stops = {
{0, theme.bg_focus},
{1, theme.bg_normal},
}
}
},
{
-- widget_container id indicates the widget which
-- will be populated with the contents of the
-- element (i.e. menu buttons, in this case)
id = "widget_container",
widget = wibox.container.margin,
margins = style.container_inner_margin
},
layout = wibox.layout.fixed.vertical
},
bg = style.container_bg_normal,
widget = wibox.container.background,
},
layout = wibox.layout.fixed.vertical,
},
widget = wibox.container.margin,
margins = style.container_shape_border_width,
},
bg = style.container_shape_border_color,
widget = wibox.container.background,
shape = style.container_shape,
fg = style.container_fg_normal,
-- This id should indicate the part of the widget which should
-- change depending on certain events. Although this is useful for
-- buttons, it's completely useless for containers. This behaviour might
-- change in the future in favor of using callbacks instead of ids.
id = "widget_background"
}
end
-- Note that even after modifying the template, all of the variables
-- are still usable (if you copied the template from the AWMTK library or made
-- your template compatible, of course)
theme.menu_container_shape_border_width = dpi(1)
theme.menu_container_shape_border_color = {
type = "linear",
from = {0,0},
to = {0,50},
stops = {
{0, "#3E3E3E"},
{1, "#1E1E1E"}
}
}
-- Tasklist
theme.tasklist_button_rounding = 4
-- These are defined as usual rather than using the awmtk style
theme.tasklist_bg_normal = {
type = "linear",
from = {0,0},
to = {0,button_size},
stops = {
{0,"#18181F"},
{0.4,"#262626"},
{1,"#18181F"}
}
}
theme.tasklist_bg_focus = {
type = "linear",
from = {0,0},
to = {0,button_size},
stops = {
{0,"#363636"},
{0.4,"#424242"},
{1,"#363636"}
}
}
theme.tasklist_button_shape_border_color = {
type = "linear",
from = {0,0},
to = {0,button_size},
stops = {
{0,"#212124"},
{0.4,"#2E2E2E"},
{1,"#212124"}
}
}
theme.tasklist_button_shape_border_width = dpi(1)
-- Launcher
theme.launcher_button_rounding = 4
theme.launcher_button_bg_normal = theme.tasklist_bg_normal
theme.launcher_button_bg_focus = theme.tasklist_bg_focus
theme.launcher_button_bg_shape_border_color = theme.tasklist_button_bg_shape_border_color
theme.launcher_button_bg_shape_border_width = dpi(1)
-- Hotkeys
theme.hotkeys_border_color = "#262626"
theme.hotkeys_opacity = 1
-- Taglist
local taglist_square_size = dpi(4)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
-- Wallpaper switcher
theme.wallpapers_button_rounding = 5
theme.wallpapers_container_rounding = 5
theme.wallpapers_icon_bg_normal = theme.topbar_bg
-- Notifications widget
theme.mailbox_button_rounding = 5
theme.mailbox_container_rounding = 5
-- Volume slider
theme.volume_container_rounding = 5
theme.volume_icon_bg_normal = theme.topbar_bg
-- Drawer
theme.drawer_icon_bg_normal = theme.topbar_bg
-- Battery widget
theme.battery_icon_bg_normal = theme.topbar_bg
-- Notifications
-- (these are untouched as of now and don't fall under AWMTK configuration model. this might change in the future)
theme.notification_width = dpi(250)
theme.notification_height = dpi(80)
-- }}}
-- {{{ Icons
-- Define the image to load
theme.titlebar_close_button_normal = global.themes_dir..theme.name.."/titlebar/close_normal.png"
theme.titlebar_close_button_focus = global.themes_dir..theme.name.."/titlebar/close_focus.png"
theme.titlebar_minimize_button_normal = global.themes_dir..theme.name.."/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = global.themes_dir..theme.name.."/titlebar/minimize_focus.png"
theme.titlebar_ontop_button_normal_inactive = global.themes_dir..theme.name.."/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = global.themes_dir..theme.name.."/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = global.themes_dir..theme.name.."/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = global.themes_dir..theme.name.."/titlebar/ontop_focus_active.png"
theme.titlebar_sticky_button_normal_inactive = global.themes_dir..theme.name.."/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive = global.themes_dir..theme.name.."/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = global.themes_dir..theme.name.."/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active = global.themes_dir..theme.name.."/titlebar/sticky_focus_active.png"
theme.titlebar_floating_button_normal_inactive = global.themes_dir..theme.name.."/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = global.themes_dir..theme.name.."/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = global.themes_dir..theme.name.."/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = global.themes_dir..theme.name.."/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_inactive = global.themes_dir..theme.name.."/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = global.themes_dir..theme.name.."/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = global.themes_dir..theme.name.."/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = global.themes_dir..theme.name.."/titlebar/maximized_focus_active.png"
theme.wallpaper = global.themes_dir..theme.name.."/background.png"
-- You can use your own layout icons like this:
theme.layout_fairh = global.themes_dir..theme.name.."/layouts/fairhw.png"
theme.layout_fairv = global.themes_dir..theme.name.."/layouts/fairvw.png"
theme.layout_floating = global.themes_dir..theme.name.."/layouts/floatingw.png"
theme.layout_magnifier = global.themes_dir..theme.name.."/layouts/magnifierw.png"
theme.layout_max = global.themes_dir..theme.name.."/layouts/maxw.png"
theme.layout_fullscreen = global.themes_dir..theme.name.."/layouts/fullscreenw.png"
theme.layout_tilebottom = global.themes_dir..theme.name.."/layouts/tilebottomw.png"
theme.layout_tileleft = global.themes_dir..theme.name.."/layouts/tileleftw.png"
theme.layout_tile = global.themes_dir..theme.name.."/layouts/tilew.png"
theme.layout_tiletop = global.themes_dir..theme.name.."/layouts/tiletopw.png"
theme.layout_spiral = global.themes_dir..theme.name.."/layouts/spiralw.png"
theme.layout_dwindle = global.themes_dir..theme.name.."/layouts/dwindlew.png"
theme.layout_cornernw = global.themes_dir..theme.name.."/layouts/cornernww.png"
theme.layout_cornerne = global.themes_dir..theme.name.."/layouts/cornernew.png"
theme.layout_cornersw = global.themes_dir..theme.name.."/layouts/cornersww.png"
theme.layout_cornerse = global.themes_dir..theme.name.."/layouts/cornersew.png"
theme_assets.recolor_layout(theme, theme.fg_normal)
theme = require("themes.icons")(theme)
-- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = "Adwaita"
-- }}}
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80