Update 'bin/periodic/fix-theming'

This commit is contained in:
Rokosun 2022-09-19 00:40:44 +02:00
parent 73471917ef
commit 06ccad7d89

View File

@ -1,8 +1,9 @@
#!/bin/bash
while read -r line; do
# Check if the system theme has been changed
if [ "$line" = 'set: /Net/ThemeName' ]; then
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
@ -13,22 +14,22 @@ while read -r line; do
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"
# Check if the icon theme has been changed
elif [ "$line" = 'set: /Net/IconThemeName' ]; then
;;
# 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
sed -i "s/^icon_theme=.*$/icon_theme=$icon_theme/" "$HOME"/.config/qt5ct/qt5ct.conf
sed -i "s/^icon_theme=.*$/icon_theme=$icon_theme/" "$HOME"/.config/qt6ct/qt6ct.conf
# Check if the system font has been changed
elif [ "$line" = 'set: /Gtk/FontName' ]; then
;;
# 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"
fi
;;
esac
done < <(xfconf-query -c xsettings -m)