niri: set background and toggle (dark/light)

This commit is contained in:
2026-05-20 22:25:26 +02:00
parent 65e82799d6
commit dfd9b52488
4 changed files with 23 additions and 1 deletions

View File

@@ -321,3 +321,5 @@ binds {
Mod+Shift+P { power-off-monitors; }
}
include "dark.kdl"

View File

@@ -0,0 +1,9 @@
layout {
background-color "#414853"
focus-ring {
width 4
active-color "#5396c7"
inactive-color "#505050"
}
}

View File

@@ -0,0 +1,3 @@
layout {
background-color "#c0c1c2"
}

View File

@@ -12,9 +12,11 @@ fi
if [ "$THEME" = dark ]; then
GTK_THEME=Arc-Dark
BG_COLOR='#414853'
rm -f ~/.lightmode
elif [ "$THEME" = light ]; then
GTK_THEME=Arc-Light
BG_COLOR='#c0c1c2'
touch ~/.lightmode
else
echo "error: unknown theme: should be either dark, light or toggle" >&2
@@ -44,7 +46,6 @@ 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 'five-colors-dark'
elif [ "$THEME" = light ]; then
@@ -52,12 +53,19 @@ elif [ "$THEME" = light ]; then
fi
# GTK
XSET=$(readlink -e ~/.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
# niri
NIRI=$(readlink -e ~/.config/niri/config.kdl)
if [ -n "$NIRI" ]; then
sed -i -E "s%^(include) \"(dark|light).kdl\".*%\\1 \"${THEME}.kdl\"%" "$NIRI"
fi
# waybar
WCSS=$(readlink -e ~/.config/waybar/style.css)
if [ -f "$WCSS" ]; then