lupan-set-theme follow links, awesome lighter fg_normal

- awesome: fg_normal is common between themes so make it somewhat
lighter then it was on dark theme
This commit is contained in:
2025-09-29 22:18:53 +02:00
parent 270338f6d3
commit f76cac70eb
3 changed files with 20 additions and 15 deletions

View File

@@ -2,8 +2,9 @@
THEME="$1"
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
if [ "$THEME" = "toggle" ]; then
if grep Materia-dark ~/.config/xsettingsd/xsettingsd.conf > /dev/null; then
if grep Materia-dark "$XSET" > /dev/null; then
THEME=light
else
THEME=dark
@@ -19,22 +20,25 @@ else
exit 1
fi
if [ -f ~/.Xresources ]; then
XRES=$(readlink -e ~/.Xresources)
if [ -n "$XRES" ]; then
if [ "$THEME" = dark ]; then
sed -i 's/^#undef THEME_DARK/#define THEME_DARK/' ~/.Xresources
sed -i 's/^#undef THEME_DARK/#define THEME_DARK/' "$XRES"
elif [ "$THEME" = light ]; then
sed -i 's/^#define THEME_DARK/#undef THEME_DARK/' ~/.Xresources
sed -i 's/^#define THEME_DARK/#undef THEME_DARK/' "$XRES"
fi
xrdb -merge ~/.Xresources
xrdb -merge "$XRES"
killall -USR1 st
fi
# Alacritty
if [ -f ~/.config/alacritty/alacritty.yml ]; then
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
AYML=$(readlink -e ~/.config/alacritty/alacritty.yml)
if [ -n "$AYML" ]; then
sed -i "s/^colors: [*].*/colors: *$THEME/" "$AYML"
fi
if [ -f ~/.config/alacritty/alacritty.toml ]; then
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" ~/.config/alacritty/alacritty.toml
ATOML=$(readlink -e ~/.config/alacritty/alacritty.toml)
if [ -f "$ATOML" ]; then
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML"
fi
if [ "$THEME" = dark ]; then
@@ -44,13 +48,14 @@ elif [ "$THEME" = light ]; then
fi
# GTK
if [ -f ~/.config/xsettingsd/xsettingsd.conf ]; then
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" ~/.config/xsettingsd/xsettingsd.conf
if [ -n "$XSET" ]; then
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" "$XSET"
pkill -HUP -x xsettingsd
gsettings set org.gnome.desktop.interface gtk-theme "${GTK_THEME}"
fi
# waybar
if [ -f ~/.config/waybar/style.css ]; then
sed -i -E "s#file:///.*/(light|dark)[.]css#file://$HOME/.config/waybar/$THEME.css#" ~/.config/waybar/style.css
WCSS=$(readlink -e ~/.config/waybar/style.css)
if [ -f "$WCSS" ]; then
sed -i -E "s#file:///.*/(light|dark)[.]css#file://$HOME/.config/waybar/$THEME.css#" "$WCSS"
fi