From 7c05d57053bb032d03eb3095d81c53a6f7f78230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Tue, 7 Oct 2025 09:01:26 +0200 Subject: [PATCH] lupan-set-theme: toggle based on existence of ~/.lightmode, update dwm theme --- xsession/bin/lupan-set-theme | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xsession/bin/lupan-set-theme b/xsession/bin/lupan-set-theme index dfe57fc..fefbce3 100755 --- a/xsession/bin/lupan-set-theme +++ b/xsession/bin/lupan-set-theme @@ -2,24 +2,27 @@ THEME="$1" -XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf) if [ "$THEME" = "toggle" ]; then - if grep Materia-dark "$XSET" > /dev/null; then - THEME=light - else + if [ -e ~/.lightmode ]; then THEME=dark + else + THEME=light fi fi if [ "$THEME" = dark ]; then GTK_THEME=Materia-dark + rm -f ~/.lightmode elif [ "$THEME" = light ]; then GTK_THEME=Materia-light + touch ~/.lightmode else echo "error: unknown theme: should be either dark, light or toggle" >&2 exit 1 fi +killall -USR1 dwm + XRES=$(readlink -e ~/.Xresources) if [ -n "$XRES" ]; then if [ "$THEME" = dark ]; then @@ -41,6 +44,7 @@ if [ -f "$ATOML" ]; then sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML" fi +XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf) if [ "$THEME" = dark ]; then kitten themes --reload-in=all Afterglow elif [ "$THEME" = light ]; then