From e44aedffc2be1281634502c7ff3435ff265a8503 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Sat, 5 Mar 2022 01:19:41 +0000 Subject: [PATCH] Made the carbon theme prettier --- themes/carbon/theme.lua | 190 ++++++++++++++++++++++++++++------------ 1 file changed, 136 insertions(+), 54 deletions(-) diff --git a/themes/carbon/theme.lua b/themes/carbon/theme.lua index 35370f0..9439187 100644 --- a/themes/carbon/theme.lua +++ b/themes/carbon/theme.lua @@ -28,6 +28,7 @@ local dpi = xresources.apply_dpi local theme = {} -- {{{ Color definitions -- These variables define a fallback state for all widgets to use. +theme.font = "sans 8" theme.name = "carbon" theme.bg_normal = "#19191D" @@ -44,7 +45,7 @@ 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_focus = theme.bg_focus theme.border_marked = theme.bg_marked -- }}} @@ -107,11 +108,33 @@ These variables control the spacing of widgets in various layouts. -- 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_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 @@ -137,8 +160,8 @@ 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. +`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 @@ -156,84 +179,92 @@ 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_rounding = 5 theme.menu_button_inner_margin = 2 --`container` is the background of the menu theme.menu_container_spacing = 4 -theme.menu_container_rounding = 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 = 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 ]] +theme.powercontrol_icon_rounding = 5 -- 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. +-- 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). --- 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. +-- 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 all menus in such a way --- that all of them will contain a gradient bar on top. +-- 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 + { + { + -- (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, }, - widget = wibox.container.background, - bg = { - type = "linear", - from = {0,0}, - to = {0,8}, - stops = { - {0, theme.bg_focus}, - {1, theme.bg_normal}, - } - } + layout = wibox.layout.fixed.vertical, }, - { - id = "widget_container", - widget = wibox.container.margin, - margins = style.container_inner_margin, - }, - layout = wibox.layout.fixed.vertical, + widget = wibox.container.margin, + margins = style.container_shape_border_width, }, - bg = style.container_bg_normal, - id = "widget_background", + bg = style.container_shape_border_color, 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 + 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 +-- 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", @@ -246,6 +277,45 @@ theme.menu_container_shape_border_color = { } -- 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" @@ -259,6 +329,18 @@ theme.taglist_squares_sel = theme_assets.taglist_squares_sel( 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 + +-- Notifications widget +theme.mailbox_button_rounding = 5 +theme.mailbox_container_rounding = 5 + +-- Volume slider +theme.volume_container_rounding = 5 + -- 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)