2022-09-18 20:05:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
while read -r line; do
|
2022-09-15 23:14:20 +00:00
|
|
|
|
2022-09-18 22:40:44 +00:00
|
|
|
case "$line" in
|
|
|
|
# When the system theme has been changed
|
|
|
|
'set: /Net/ThemeName')
|
|
|
|
# Get the current system theme
|
|
|
|
theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
|
|
|
|
# Find the best match for the xfwm4 theme that corresponds with the current system theme
|
|
|
|
xfwm4_theme=$(find /usr/share/themes/ /usr/local/share/themes/ "$HOME"/.themes/ "$HOME"/.local/share/themes/ -mindepth 2 -maxdepth 2 -type d -name xfwm4 -printf '%h\n' 2>/dev/null | grep -o "/${theme}[^/]*$" | sort | head -n1)
|
|
|
|
# If a match is not found then use the Default theme
|
|
|
|
[ -z "$xfwm4_theme" ] && xfwm4_theme='Default'
|
|
|
|
# Apply the xfwm4 theme
|
|
|
|
xfconf-query -c xfwm4 -p /general/theme -n -t string -s "${xfwm4_theme#/}"
|
|
|
|
# Apply the current theme with gsettings
|
|
|
|
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
|
|
|
|
;;
|
|
|
|
# When the icon theme has been changed
|
|
|
|
'set: /Net/IconThemeName')
|
|
|
|
# Get the current icon theme
|
|
|
|
icon_theme=$(xfconf-query -c xsettings -p /Net/IconThemeName)
|
|
|
|
# Apply the same theme in qt5ct and qt6ct configuration
|
2022-09-21 17:56:17 +00:00
|
|
|
for file in "$HOME"/.config/qt5ct/qt5ct.conf "$HOME"/.config/qt6ct/qt6ct.conf; do
|
|
|
|
if [ -f "$file" ]; then
|
|
|
|
sed -i "s/^icon_theme=.*$/icon_theme=$icon_theme/" "$file"
|
|
|
|
else
|
|
|
|
printf '[Appearance]\nicon_theme=%s\nstyle=gtk2\n' "$icon_theme" > "$file"
|
|
|
|
fi
|
|
|
|
done
|
2022-09-18 22:40:44 +00:00
|
|
|
;;
|
|
|
|
# When the system font has been changed
|
|
|
|
'set: /Gtk/FontName')
|
|
|
|
# Get the current system font
|
|
|
|
font=$(xfconf-query -c xsettings -p /Gtk/FontName)
|
|
|
|
# Apply the same font for the title of xfce windows
|
|
|
|
xfconf-query -c xfwm4 -p /general/title_font -n -t string -s "$font"
|
|
|
|
;;
|
|
|
|
esac
|
2022-09-15 23:14:20 +00:00
|
|
|
|
2022-09-21 17:56:17 +00:00
|
|
|
done < <(xfconf-query -c xsettings -m)
|