From ce7910508a945c226041840e3385a25e69581eb6 Mon Sep 17 00:00:00 2001 From: rxyhn Date: Mon, 27 Jun 2022 00:19:10 +0700 Subject: [PATCH] chore: generate wallpaper from xresources --- themes/night/background.png | Bin 11542 -> 0 bytes themes/night/theme.lua | 51 +++++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 10 deletions(-) delete mode 100644 themes/night/background.png diff --git a/themes/night/background.png b/themes/night/background.png deleted file mode 100644 index d7f7a1c9f532e23b37c0aed7ca70161cfecc93f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11542 zcmeAS@N?(olHy`uVBq!ia0y~yU~gbxV6os}1B$%3e9)PJfw48y**U<|*;%2WC_gPT zCzXLgV`A+@TaUvIGDqX1w<=9lDw}Xg(YbV!g4UxIp&CxD0oq$$B^14EzpzBnv#?Mk zhMTWWCrmbGPHAa@D9b^90e5wES8>gc^_~k|d)SZvttfwA_?_>Axt5RV?qdw0n|pk; zG@pFZcKRS{E8!qv=%SkTYV)EQZO?z~YVTiP&N=UC?Yr|A*NgbD{a|?{xlCH@qt(YN z%a#`3Q}5fbX^Fsm;eM$S$4Bn#PV4P2)U$l^e5RoC?3v1a0^CdardiLJ$~(1UlEu0e zQcr&u>uJx~Zn1i*RQBD;`wc=aOq;&L&$vxQYy*cNQ_7VMja)h^8CN|FCocTEq}~42 z57(lTPi`?NAGcW*plDh5!T!hHwUKiq$|pN{F8FhS4ko4u;Xf0UQjYg##oQMhl10!eKNojOGP~(RyLDUSJq)BY_jaXkHl2 z3!`}fk_LuXUNGFsvfDU%jSkcFdsUX^-2WfGe$Fqx?(VMQ{2g_V)BYKM{(F1+!?PE= z_x`ZYud=%%UJ!4~LnM%5-`rq%V}IlanUlpTn;WW`XR9$V_dNJ}ay9pLIosNu z;?m`y5c@axxd%hetZ;|X@fn5@(5MLZ21WV?+vn-&hYe=(9RBe7{E@!@B6#|;g1hHTN!@a-B{`W-mkqsKmLE=+kc1E41x!6IS1Tmm3 zoYg7}JC6Kel7JYi;KTqL$_9cCfd=TvqY_I3ScIX0184~t3~yyWZl069ZNkICAY!}t zONfX`hn8|myGTm&nT8-^mo$fo5(?TIIAukZ9h|!}dII*{&yM+B^J(tiROS(o=HcVa zM@|VCEdN}%|HbF~vVLle4W*2q*??*3z&?J42ls!Fnx2wUIc8jbR}giivTo1*-s{uV z#plS|+Sv6Q_8J~DS@!;MP|W>1y3gVoN)tQJ9p78Y95dx>n)S8WYa1Cp>~VNfx$s1_ z%6F!Qoty_4>JxT-YGwtc(z@riLJY;5H$jptILAPkqhrJ1a2Te;KSxTc_y042&Xq7s zKQDd&ngB+leK<$^=)4y=c1IKWXd)k8-L@ey+g;_$A;-YL^$@fcV3^jcqXq0}0XsTI z3{C^11uQriM&}M8!7y6jgTrC8a2PEdMn_p7MZ$2+3-PNL_G)TgxgP-Xrl+f)%Q~lo FCIE^KR1p9G diff --git a/themes/night/theme.lua b/themes/night/theme.lua index 0f482dc18..a5d84d91e 100644 --- a/themes/night/theme.lua +++ b/themes/night/theme.lua @@ -1,19 +1,19 @@ ------------------------------------------- --- Aesthetic Night awesomewm theme -- --- Created by https://github.com/rxyhn -- ------------------------------------------- +-------------------------------------------- +--- Aesthetic Night awesomewm theme --- +--- Created by https://github.com/rxyhn --- +-------------------------------------------- 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") +local gears = require("gears") +local gfs = gears.filesystem local themes_path = gfs.get_themes_dir() --- inherit default theme -local theme = dofile(themes_path .. "default/theme.lua") --- load vector assets' generators for this theme +-- inherit xresources theme: +local theme = dofile(themes_path .. "xresources/theme.lua") theme.font = "sans 8" @@ -55,8 +55,39 @@ theme.menu_width = dpi(100) -- Notification theme.notification_border_color = theme.border_color_active --- Wallpaper -theme.wallpaper = themes_path .. "night/background.png" +-- Generate wallpaper: +local wallpaper_bg = "#162026" +local wallpaper_fg = theme.fg_normal +local wallpaper_alt_fg = theme.fg_focus + +local rsvg = pcall(function() + return require("lgi").Rsvg +end) + +if rsvg then + local handle = require("lgi").Rsvg.Handle.new_from_file(themes_path .. "xresources/wallpaper.svg") + + if handle then + handle:set_stylesheet([[ + .normal { + fill: ]] .. wallpaper_fg .. [[; + } + .background { + fill: ]] .. wallpaper_bg .. [[; + stroke: ]] .. wallpaper_bg .. [[; + } + .logo { + fill: ]] .. wallpaper_alt_fg .. [[; + } + ]]) + + theme.wallpaper = handle + end +else + gears.debug.print_warning("Could not load the wallpaper: librsvg is not installed.") +end + +theme.wallpaper_bg = wallpaper_bg -- Recolor Layout icons: theme = theme_assets.recolor_layout(theme, theme.fg_normal)