From c6f617ab98040e0ccd0ac030e46583de715b130f Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 16 Feb 2020 01:33:45 -0500 Subject: [PATCH] themes: Add `ruled.notification` to all themes. The rational behind this is that adding more and more `beautiful` variables doesn't scale. While not everybody is on board with this, I think we should move more logic into the theme to put an end to the unscalable complexity plagging some modules (such as the tasklist). Instead of adding a variable for the background and foreground color of urgent notification, we can now use the rules. --- themes/default/theme.lua | 9 +++++++++ themes/gtk/theme.lua | 9 +++++++++ themes/sky/theme.lua | 10 ++++++++++ themes/xresources/theme.lua | 9 +++++++++ themes/zenburn/theme.lua | 9 +++++++++ 5 files changed, 46 insertions(+) diff --git a/themes/default/theme.lua b/themes/default/theme.lua index fd9f9c43c..79a4d2eee 100644 --- a/themes/default/theme.lua +++ b/themes/default/theme.lua @@ -4,6 +4,7 @@ local theme_assets = require("beautiful.theme_assets") local xresources = require("beautiful.xresources") +local rnotification = require("ruled.notification") local dpi = xresources.apply_dpi local gfs = require("gears.filesystem") @@ -126,6 +127,14 @@ theme.awesome_icon = theme_assets.awesome_icon( -- from /usr/share/icons and /usr/share/icons/hicolor will be used. theme.icon_theme = nil +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/themes/gtk/theme.lua b/themes/gtk/theme.lua index 392791ff3..ff780e67d 100644 --- a/themes/gtk/theme.lua +++ b/themes/gtk/theme.lua @@ -5,6 +5,7 @@ local theme_assets = require("beautiful.theme_assets") local dpi = require("beautiful.xresources").apply_dpi +local rnotification = require("ruled.notification") local gfs = require("gears.filesystem") local themes_path = gfs.get_themes_dir() local gears_shape = require("gears.shape") @@ -345,6 +346,14 @@ theme.wallpaper = function(s) return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s) end +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80:foldmethod=marker diff --git a/themes/sky/theme.lua b/themes/sky/theme.lua index b724bad89..18c678c6c 100644 --- a/themes/sky/theme.lua +++ b/themes/sky/theme.lua @@ -6,6 +6,7 @@ local theme_assets = require("beautiful.theme_assets") local xresources = require("beautiful.xresources") +local rnotification = require("ruled.notification") local dpi = xresources.apply_dpi local themes_path = require("gears.filesystem").get_themes_dir() @@ -97,6 +98,15 @@ theme.titlebar_maximized_button_focus_inactive = themes_path .. "default/titleba theme.titlebar_maximized_button_normal_active = themes_path .. "default/titlebar/maximized_normal_active.png" theme.titlebar_maximized_button_focus_active = themes_path .. "default/titlebar/maximized_focus_active.png" + +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/themes/xresources/theme.lua b/themes/xresources/theme.lua index 4168bcc07..11edfe7dd 100644 --- a/themes/xresources/theme.lua +++ b/themes/xresources/theme.lua @@ -5,6 +5,7 @@ local theme_assets = require("beautiful.theme_assets") local xresources = require("beautiful.xresources") +local rnotification = require("ruled.notification") local dpi = xresources.apply_dpi local xrdb = xresources.get_current_theme() local gfs = require("gears.filesystem") @@ -129,6 +130,14 @@ theme.wallpaper = function(s) return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s) end +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/themes/zenburn/theme.lua b/themes/zenburn/theme.lua index ead4081b2..ea933d8b7 100644 --- a/themes/zenburn/theme.lua +++ b/themes/zenburn/theme.lua @@ -4,6 +4,7 @@ ------------------------------- local themes_path = require("gears.filesystem").get_themes_dir() +local rnotification = require("ruled.notification") local dpi = require("beautiful.xresources").apply_dpi -- {{{ Main @@ -131,6 +132,14 @@ theme.titlebar_maximized_button_normal_inactive = themes_path .. "zenburn/titleb -- }}} -- }}} +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80