329 lines
13 KiB
Lua
329 lines
13 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.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_normal
|
|
theme.border_marked = theme.bg_marked
|
|
-- }}}
|
|
|
|
-- 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.."FF"
|
|
theme.unitybar_border_color = theme.bg_normal
|
|
theme.unitybar_width = dpi(50)
|
|
theme.unitybar_inner_margin = 3
|
|
|
|
-- }}}
|
|
|
|
-- {{{ 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 affect a particular widget's
|
|
style properties, use the `style` table in its arguments table.
|
|
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 = 4
|
|
theme.menu_button_inner_margin = 2
|
|
--`container` is the background of the menu
|
|
theme.menu_container_spacing = 4
|
|
theme.menu_container_rounding = 4
|
|
--`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 = 4
|
|
|
|
|
|
--[[ Another thing that should be noted is that it's possible to
|
|
override primitve templates on a per-widget basis. For example, it's
|
|
possible to add some custom static elements to the buttons in
|
|
launcher widget and tasklist widget. Although to do this safely, you
|
|
might want to consider reading the original templates in
|
|
.../awesome/libs/awmtk.lua ]]
|
|
|
|
-- Calculate height/width of the button
|
|
local button_size = theme.unitybar_width - theme.unitybar_inner_margin*2
|
|
|
|
-- Launcher
|
|
theme.launcher_button_rounding = 4
|
|
-- Modifying the button template
|
|
-- All templates are functions that receive a processed style
|
|
-- so that it would be possible to overwrite template variables.
|
|
|
|
-- There are two "special id's" that define the root of the template
|
|
-- (the furthest outer element) and the container point
|
|
-- (the innermost element). widget_background is used by some
|
|
-- widgets to set the background value on event. widget_container is
|
|
-- used as an anchor point which is populated by the contents of the
|
|
-- widget after processing.
|
|
|
|
-- Example: this templates overrides all menus in such a way
|
|
-- that all of them will contain a gradient bar on top.
|
|
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},
|
|
}
|
|
}
|
|
},
|
|
{
|
|
id = "widget_container",
|
|
widget = wibox.container.margin,
|
|
margins = style.container_inner_margin,
|
|
},
|
|
layout = wibox.layout.fixed.vertical,
|
|
},
|
|
bg = style.container_bg_normal,
|
|
id = "widget_background",
|
|
widget = wibox.container.background,
|
|
shape = style.container_shape,
|
|
shape_border_width = style.container_shape_border_width,
|
|
shape_border_color = style.container_shape_border_color,
|
|
fg = style.container_fg_normal
|
|
}
|
|
end
|
|
|
|
-- Note that even after modifying the template, all of the variables
|
|
-- are still usable
|
|
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
|
|
|
|
-- Hotkeys
|
|
theme.hotkeys_border_color = "#262626"
|
|
theme.hotkeys_opacity = 0.2
|
|
|
|
-- 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
|
|
)
|
|
-- 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)
|
|
|
|
-- 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
|