Notification Customization & Theme Headers

- Add notification configuration to rc.lua
- Add headings to theme in README.org
- Add notification theming
This commit is contained in:
Sravan Balaji
2023-03-26 20:06:40 -04:00
parent c5bfbfd4b1
commit fb7139431f
3 changed files with 164 additions and 65 deletions

View File

@@ -14,6 +14,7 @@
- [[#modkey][Modkey]]
- [[#layouts][Layouts]]
- [[#tags][Tags]]
- [[#notifications][Notifications]]
- [[#status-bar][Status Bar]]
- [[#launcher-and-main-menu][Launcher and Main Menu]]
- [[#keyboard-map-indicator-and-switcher][Keyboard Map Indicator and Switcher]]
@@ -38,6 +39,27 @@
- [[#focus-follows-mouse][Focus follows Mouse]]
- [[#focus-border-color][Focus Border Color]]
- [[#theme][Theme]]
- [[#libraries-1][Libraries]]
- [[#inherit-default-theme][Inherit Default Theme]]
- [[#variable-definitions-1][Variable Definitions]]
- [[#windows][Windows]]
- [[#notifications-1][Notifications]]
- [[#tool-tip][Tool Tip]]
- [[#tag-list-1][Tag List]]
- [[#task-list-1][Task List]]
- [[#title-bar][Title Bar]]
- [[#mouse-finder][Mouse Finder]]
- [[#menu][Menu]]
- [[#icons][Icons]]
- [[#layout][Layout]]
- [[#title-bar-1][Title Bar]]
- [[#applications][Applications]]
- [[#awesome][Awesome]]
- [[#tag-list-squares][Tag List Squares]]
- [[#wallpaper][Wallpaper]]
- [[#detect-light--dark-theme][Detect Light / Dark Theme]]
- [[#generate-wallpaper][Generate Wallpaper]]
- [[#return-theme][Return Theme]]
* Welcome
@@ -220,6 +242,13 @@ awful.layout.layouts = {
taglist = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }
#+END_SRC
* Notifications
#+BEGIN_SRC lua :tangle rc.lua
naughty.config.defaults.timeout = 10 -- in seconds
naughty.config.defaults.position = "top_right"
#+END_SRC
* Status Bar
** Launcher and Main Menu
@@ -808,6 +837,8 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
Based on Awesome theme which follows xrdb config by Yauhen Kirylau.
** Libraries
#+BEGIN_SRC lua :tangle theme.lua
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
@@ -817,12 +848,19 @@ local gfs = require("gears.filesystem")
local themes_path = gfs.get_themes_dir()
local shape = require("gears.shape")
local naughty = require("naughty")
#+END_SRC
-- inherit default theme
** Inherit Default Theme
Load vector assets' generators for this theme
#+BEGIN_SRC lua :tangle theme.lua
local theme = dofile(themes_path.."default/theme.lua")
-- load vector assets' generators for this theme
#+END_SRC
-- local variables
** Variable Definitions
#+BEGIN_SRC lua :tangle theme.lua
local font = "Ubuntu Nerd Font"
local font_size = dpi(11)
local gap_size = dpi(10)
@@ -835,7 +873,11 @@ local notification_shape = shape.rounded_rect
local notification_max_width = dpi(700)
local notification_max_height = dpi(125)
local notification_icon_size = dpi(125)
#+END_SRC
** Windows
#+BEGIN_SRC lua :tangle theme.lua
theme.font = font .. " " .. tostring(font_size)
theme.bg_normal = xrdb.background
@@ -855,7 +897,11 @@ theme.border_normal = xrdb.color0
theme.border_focus = theme.bg_focus
theme.border_marked = xrdb.color10
theme.gap_single_client = true
#+END_SRC
** Notifications
#+BEGIN_SRC lua :tangle theme.lua
theme.notification_font = font
theme.notification_bg = xrdb.background
theme.notification_fg = xrdb.foreground
@@ -868,37 +914,88 @@ theme.notification_max_width = notification_max_width
theme.notification_max_height = notification_max_height
theme.notification_icon_size = notification_icon_size
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- 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]
-- Example:
--theme.taglist_bg_focus = "#ff0000"
naughty.config.padding = gap_size
naughty.config.spacing = gap_size
naughty.config.presets.critical.bg = xrdb.color1
naughty.config.presets.critical.fg = xrdb.foreground
#+END_SRC
** Tool Tip
Configuration options:
#+BEGIN_EXAMPLE
tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
#+END_EXAMPLE
#+BEGIN_SRC lua :tangle theme.lua
theme.tooltip_fg = theme.fg_normal
theme.tooltip_bg = theme.bg_normal
#+END_SRC
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
** Tag List
Configuration options:
#+BEGIN_EXAMPLE
taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
#+END_EXAMPLE
** Task List
Configuration options:
#+BEGIN_EXAMPLE
tasklist_[bg|fg]_[focus|urgent]
#+END_EXAMPLE
** Title Bar
Configuration options:
#+BEGIN_EXAMPLE
titlebar_[bg|fg]_[normal|focus]
#+END_EXAMPLE
** Mouse Finder
Configuration options:
#+BEGIN_EXAMPLE
mouse_finder_[color|timeout|animate_timeout|radius|factor]
#+END_EXAMPLE
** Menu
Configuration options:
#+BEGIN_EXAMPLE
menu_[bg|fg]_[normal|focus]
menu_[border_color|border_width]
#+END_EXAMPLE
#+BEGIN_SRC lua :tangle theme.lua
theme.menu_submenu_icon = themes_path.."default/submenu.png"
theme.menu_height = menu_height
theme.menu_width = menu_width
#+END_SRC
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000"
** Icons
-- Recolor Layout icons:
*** Layout
Recolor Layout icons:
#+BEGIN_SRC lua :tangle theme.lua
theme = theme_assets.recolor_layout(theme, theme.fg_normal)
#+END_SRC
-- Recolor titlebar icons:
--
*** Title Bar
Recolor titlebar icons:
#+BEGIN_SRC lua :tangle theme.lua
local function darker(color_value, darker_n)
local result = "#"
for s in color_value:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
@@ -927,32 +1024,56 @@ theme = theme_assets.recolor_titlebar(
theme = theme_assets.recolor_titlebar(
theme, xrdb.color1, "focus", "press"
)
#+END_SRC
-- 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.
*** Applications
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.
#+BEGIN_SRC lua :tangle theme.lua
theme.icon_theme = nil
#+END_SRC
-- Generate Awesome icon:
*** Awesome
Generate Awesome icon:
#+BEGIN_SRC lua :tangle theme.lua
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
#+END_SRC
-- Generate taglist squares:
*** Tag List Squares
Generate taglist squares:
#+BEGIN_SRC lua :tangle theme.lua
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
)
#+END_SRC
-- Try to determine if we are running light or dark colorscheme:
** Wallpaper
*** Detect Light / Dark Theme
Try to determine if we are running light or dark colorscheme:
#+BEGIN_SRC lua :tangle theme.lua
local bg_numberic_value = 0;
for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
bg_numberic_value = bg_numberic_value + tonumber("0x"..s);
end
local is_dark_bg = (bg_numberic_value < 383)
#+END_SRC
-- Generate wallpaper:
*** Generate Wallpaper
#+BEGIN_SRC lua :tangle theme.lua
local wallpaper_bg = xrdb.color8
local wallpaper_fg = xrdb.color7
local wallpaper_alt_fg = xrdb.color12
@@ -962,8 +1083,10 @@ end
theme.wallpaper = function(s)
return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s)
end
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
#+END_SRC
** Return Theme
#+BEGIN_SRC lua :tangle theme.lua
return theme
#+END_SRC

3
rc.lua
View File

@@ -89,6 +89,9 @@ awful.layout.layouts = {
taglist = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }
naughty.config.defaults.timeout = 10 -- in seconds
naughty.config.defaults.position = "top_right"
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal_cmd .. " -e man awesome" },

View File

@@ -7,11 +7,8 @@ local themes_path = gfs.get_themes_dir()
local shape = require("gears.shape")
local naughty = require("naughty")
-- inherit default theme
local theme = dofile(themes_path.."default/theme.lua")
-- load vector assets' generators for this theme
-- local variables
local font = "Ubuntu Nerd Font"
local font_size = dpi(11)
local gap_size = dpi(10)
@@ -57,37 +54,21 @@ theme.notification_max_width = notification_max_width
theme.notification_max_height = notification_max_height
theme.notification_icon_size = notification_icon_size
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- 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]
-- Example:
--theme.taglist_bg_focus = "#ff0000"
naughty.config.padding = gap_size
naughty.config.spacing = gap_size
naughty.config.presets.critical.bg = xrdb.color1
naughty.config.presets.critical.fg = xrdb.foreground
theme.tooltip_fg = theme.fg_normal
theme.tooltip_bg = theme.bg_normal
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = themes_path.."default/submenu.png"
theme.menu_height = menu_height
theme.menu_width = menu_width
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000"
-- Recolor Layout icons:
theme = theme_assets.recolor_layout(theme, theme.fg_normal)
-- Recolor titlebar icons:
--
local function darker(color_value, darker_n)
local result = "#"
for s in color_value:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
@@ -117,16 +98,12 @@ theme = theme_assets.recolor_titlebar(
theme, xrdb.color1, "focus", "press"
)
-- 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 = nil
-- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus
)
-- Generate taglist squares:
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
)
@@ -134,14 +111,12 @@ theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
-- Try to determine if we are running light or dark colorscheme:
local bg_numberic_value = 0;
for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
bg_numberic_value = bg_numberic_value + tonumber("0x"..s);
end
local is_dark_bg = (bg_numberic_value < 383)
-- Generate wallpaper:
local wallpaper_bg = xrdb.color8
local wallpaper_fg = xrdb.color7
local wallpaper_alt_fg = xrdb.color12
@@ -153,5 +128,3 @@ theme.wallpaper = function(s)
end
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80