blob: af2edad6cf729b59c3c45324bd25a43b2ef2185b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh
main () {
case "$1" in
d|dark)
set_scheme dark ;;
l|light)
set_scheme light ;;
*)
echo "usage: scheme [dark|light]" ;;
esac
}
set_scheme () {
if [ "$1" = "dark" ]; then
GTK_THEME=$(cat "$XDG_CONFIG_HOME/scheme/gtk-theme-dark")
QT_THEME=$(cat "$XDG_CONFIG_HOME/scheme/qt-theme-dark")
TERM_THEME=$(cat "$XDG_CONFIG_HOME/scheme/term-theme-dark")
FZF_COLOR=dark
PREFER_DARK="true"
PREFER_DARK_STR="prefer-dark"
else
GTK_THEME=$(cat "$XDG_CONFIG_HOME/scheme/gtk-theme-light")
QT_THEME=$(cat "$XDG_CONFIG_HOME/scheme/qt-theme-light")
TERM_THEME=$(cat "$XDG_CONFIG_HOME/scheme/term-theme-light")
FZF_COLOR=light
PREFER_DARK="false"
PREFER_DARK_STR="prefer-light"
fi
sed -ir "s|^colors: .*$|colors: $TERM_THEME|" "$XDG_CONFIG_HOME"/alacritty/alacritty.yml
sed -ir "s|theme=.*$|theme=$QT_THEME|" \
"$XDG_CONFIG_HOME"/Kvantum/kvantum.kvconfig
sed -ir "s|gtk-theme-name=.*$|gtk-theme-name=\"$GTK_THEME\"|" \
"$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
sed -ir \
-e "s|gtk-theme-name=.*$|gtk-theme-name=$GTK_THEME|" \
-e "s|gtk-application-prefer-dark-theme=.*$|gtk-application-prefer-dark-theme=$PREFER_DARK|" \
"$XDG_CONFIG_HOME"/gtk-3.0/settings.ini \
"$XDG_CONFIG_HOME"/gtk-4.0/settings.ini
gsettings set org.gnome.desktop.interface color-scheme $PREFER_DARK_STR
gsettings set org.gnome.desktop.interface gtk-theme "$GTK_THEME"
gsettings set org.gnome.desktop.wm.preferences theme "$GTK_THEME"
echo -n $FZF_COLOR > "$XDG_CONFIG_HOME"/scheme/fzf-color
# todo:
# - dmenu ?
# - send nvim clients theme update
# - restart firefox ?
# - restart thunderbird ?
}
main "$@"
|