lupan-set-theme: toggle based on existence of ~/.lightmode, update dwm theme
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user