Don't set the XFWM theme twice #26
|
@ -71,22 +71,27 @@ set_xfwm_theme() {
|
|||
|
||||
# Use the highDPI variant of the XFWM theme
|
||||
use_hdpi_theme_variant() {
|
||||
local -r current_xfwm_theme=$(xfconf-query -c xfwm4 -p /general/theme)
|
||||
# shellcheck disable=SC2015
|
||||
[ -n "$1" ] && local -r xfwm_theme="$1" ||
|
||||
local -r xfwm_theme=$(xfconf-query -c xfwm4 -p /general/theme)
|
||||
|
||||
for variant in xhdpi hdpi; do
|
||||
# If this variant of the theme is already enabled then break out of the loop
|
||||
[ "${current_xfwm_theme##*-}" = "$variant" ] && break
|
||||
[ "${xfwm_theme##*-}" = "$variant" ] && break
|
||||
|
||||
# Store the name for this variant of the theme in highDPI_theme variable
|
||||
local -r highDPI_theme=$current_xfwm_theme-$variant
|
||||
local highDPI_theme=$xfwm_theme-$variant
|
||||
|
||||
if theme_exists "$highDPI_theme"; then
|
||||
set_xfwm_theme "$highDPI_theme"
|
||||
[ "$1" != 'disable_notification' ] &&
|
||||
[ -z "$1" ] &&
|
||||
notify-send "XFWM theme changed to $highDPI_theme" "Changed to the highDPI variant of your chosen theme because you've enabled highDPI on your system"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ! theme_exists "$highDPI_theme"; then
|
||||
[ -n "$1" ] && theme_exists "$1" && set_xfwm_theme "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use the normal variant of the XFWM theme
|
||||
|
@ -98,7 +103,7 @@ use_normal_theme_variant() {
|
|||
[ "${current_xfwm_theme##*-}" != "$variant" ] && continue
|
||||
|
||||
# Store the name for the normal variant of this theme in normal_theme variable
|
||||
local -r normal_theme=${current_xfwm_theme%-"$variant"}
|
||||
local normal_theme=${current_xfwm_theme%-"$variant"}
|
||||
|
||||
if theme_exists "$normal_theme"; then
|
||||
set_xfwm_theme "$normal_theme"
|
||||
|
@ -156,10 +161,12 @@ sync_theme() {
|
|||
|
||||
# Apply the current theme for XFWM unless it's initial_sync on system reboot
|
||||
if [ "$1" != 'initial_sync' ]; then
|
||||
set_xfwm_theme "$current_theme"
|
||||
|
||||
# Use the highDPI variant of the XFWM theme if the current_window_scaling factor is 2
|
||||
[ "$current_window_scaling" -eq '2' ] && use_hdpi_theme_variant 'disable_notification'
|
||||
if [ "$current_window_scaling" -eq '2' ]; then
|
||||
use_hdpi_theme_variant "$current_theme"
|
||||
else
|
||||
set_xfwm_theme "$current_theme"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cleanup flatpak_themes_dir and remove ~/.config/gtk-4.0
|
||||
|
|
Loading…
Reference in New Issue
Block a user