fixes-package/bin/periodic/fix-theming

31 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash
sync_theme() {
# Get the current system theme
theme=$(xfconf-query -c xsettings -p /Net/ThemeName)
2023-08-03 14:42:27 +00:00
# Enable syncing the current theme with xfwm4 if not already enabled
[ "$(xfconf-query -c xsettings -p /Xfce/SyncThemes)" != 'true' ] && xfconf-query -c xsettings -p /Xfce/SyncThemes -n -t bool -s true
# Apply the current theme with gsettings
gsettings set org.gnome.desktop.interface gtk-theme "$theme"
2023-08-05 18:25:03 +00:00
# Apply the current theme for the all the GTK flatpaks
flatpak override --user --env=GTK_THEME="$theme"
}
sync_font() {
# 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"
}
2022-09-15 23:14:20 +00:00
sync_theme
sync_font
# Monitor when the user changes their system theme or font in XFCE and sync them as needed
while read -r line; do
2022-09-18 22:40:44 +00:00
case "$line" in
'set: /Net/ThemeName') sync_theme ;;
'set: /Gtk/FontName') sync_font ;;
2022-09-18 22:40:44 +00:00
esac
done < <(xfconf-query -c xsettings -m)