From 2fb0bfc376cbed6f5e4a0035fd64234ddeab8fb9 Mon Sep 17 00:00:00 2001 From: Tanvir Date: Wed, 25 Sep 2024 18:49:37 +0600 Subject: [PATCH] implement ability to set different wallpapers for each tag --- common/env.lua | 10 +++++++++- themes/colorless/theme.lua | 15 +++++++++++++-- themes/rosybrown/theme.lua | 16 ++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/common/env.lua b/common/env.lua index e64e0640..4431cb47 100644 --- a/common/env.lua +++ b/common/env.lua @@ -49,7 +49,11 @@ end -- Common functions -- Wallpaper setup env.wallpaper = function(s) - if beautiful.wallpaper then + local selected_tag = s.selected_tag + + if selected_tag and beautiful.wallpapers[selected_tag.name] then + gears.wallpaper.maximized(beautiful.wallpapers[selected_tag.name], s, true) + elseif beautiful.wallpaper then if not env.desktop_autohide and awful.util.file_readable(beautiful.wallpaper) then gears.wallpaper.maximized(beautiful.wallpaper, s, true) else @@ -58,6 +62,10 @@ env.wallpaper = function(s) end end +screen.connect_signal("tag::history::update", function(s) + env.wallpaper(s) +end) + -- Tag tooltip text generation env.tagtip = function(t) local layname = awful.layout.getname(awful.tag.getproperty(t, "layout")) diff --git a/themes/colorless/theme.lua b/themes/colorless/theme.lua index 0d8514c3..c75211d6 100644 --- a/themes/colorless/theme.lua +++ b/themes/colorless/theme.lua @@ -40,8 +40,19 @@ theme.panel_height = 40 -- panel height theme.border_width = 0 -- window border width theme.useless_gap = 5 -- useless gap theme.cellnum = { x = 96, y = 58 } -- grid layout property -theme.wallpaper = awful.util.get_configuration_dir() .. "wallpapers/RosyBrown.png" - +theme.wallpapers = { + ["1:1"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrown.png", + ["1:2"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownApple.png", + ["1:3"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownBoy.png", + ["1:4"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownMan.png", + ["1:5"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownGun.png", + + ["2:1"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownSword.png", + ["2:2"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownSword2.png", + ["2:3"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownNix.png", + ["2:4"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownGirl.png", + ["2:5"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownTree.png", +} -- Fonts theme.fonts = { main = "Fira Code 12", -- main font diff --git a/themes/rosybrown/theme.lua b/themes/rosybrown/theme.lua index ba0e27f6..f9e9c87c 100644 --- a/themes/rosybrown/theme.lua +++ b/themes/rosybrown/theme.lua @@ -13,8 +13,20 @@ theme.path = awful.util.get_configuration_dir() .. "themes/rosybrown" -- Main config theme.panel_height = 38 -- panel height -theme.wallpaper = awful.util.get_configuration_dir() .. "wallpapers/RosyBrown.png" -theme.desktopbg = theme.wallpaper +-- theme.desktopbg = theme.wallpapers["1:1"] +theme.wallpapers = { + ["1:1"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrown.png", + ["1:2"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownApple.png", + ["1:3"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownBoy.png", + ["1:4"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownMan.png", + ["1:5"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownGun.png", + + ["2:1"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownSword.png", + ["2:2"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownSword2.png", + ["2:3"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownNix.png", + ["2:4"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownGirl.png", + ["2:5"] = awful.util.get_configuration_dir() .. "wallpapers/RosyBrownTree.png", +} -- Setup parent theme settings theme:update()