From f5a0ee0dc9f5d84b206afb0fc7828b7f59c2dba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Sun, 21 Sep 2025 18:59:34 +0200 Subject: [PATCH] lupan-set-theme: toggle st theme (note: needs st patched to handle USR1) --- xsession/.Xresources | 48 ++++++++++++++++++++++++++++++++++++ xsession/bin/lupan-set-theme | 10 ++++++++ 2 files changed, 58 insertions(+) diff --git a/xsession/.Xresources b/xsession/.Xresources index 7b8afd4..84cad28 100644 --- a/xsession/.Xresources +++ b/xsession/.Xresources @@ -1,3 +1,5 @@ +#define THEME_DARK + #if HEIGHT >= 2160 Xft.dpi: 160 Xcursor.size: 48 @@ -53,3 +55,49 @@ XTerm.vt100.color14: #8FBCBB ! white XTerm.vt100.color7: #E5E9F0 XTerm.vt100.color15: #ECEFF4 + +st.font: FiraCode Nerd Font:size=10 + +#ifdef THEME_DARK +st.background: #1f212e +st.foreground: #9da0af +st.cursorColor: #bf8040 +st.reverse-cursor: #1f212e +st.color0: #1f212e +st.color1: #862d2d +st.color2: #3a783a +st.color3: #707010 +st.color4: #345eb2 +st.color5: #cc66cc +st.color6: #3a7878 +st.color7: #a1a3aa +st.color8: #4d4d4d +st.color9: #c27070 +st.color10: #40bf40 +st.color11: #acac53 +st.color12: #6b8ac7 +st.color13: #8f248f +st.color14: #509595 +st.color15: #dbdff0 +#else +st.background: #dae4f1 +st.foreground: #1f212e +st.cursorColor: #bf8040 +st.reverse-cursor: #1f212e +st.color0: #1f212e +st.color1: #862d2d +st.color2: #3a783a +st.color3: #707010 +st.color4: #345eb2 +st.color5: #cc66cc +st.color6: #3a7878 +st.color7: #a1a3aa +st.color8: #73778c +st.color9: #c27070 +st.color10: #40bf40 +st.color11: #acac53 +st.color12: #6b8ac7 +st.color13: #8f248f +st.color14: #509595 +st.color15: #dae4f1 +#endif diff --git a/xsession/bin/lupan-set-theme b/xsession/bin/lupan-set-theme index 6804e4a..e08165d 100755 --- a/xsession/bin/lupan-set-theme +++ b/xsession/bin/lupan-set-theme @@ -19,6 +19,16 @@ else exit 1 fi +if [ -f ~/.Xresources ]; then + if [ "$THEME" = dark ]; then + sed -i 's/^#undef THEME_DARK/#define THEME_DARK/' ~/.Xresources + elif [ "$THEME" = light ]; then + sed -i 's/^#define THEME_DARK/#undef THEME_DARK/' ~/.Xresources + fi + xrdb -merge ~/.Xresources + killall -USR1 st +fi + # Alacritty if [ -f ~/.config/alacritty/alacritty.yml ]; then sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml