From 216f3866cbb5768b57123602f0ac8f6a9e71bf43 Mon Sep 17 00:00:00 2001 From: Christian Schendel Date: Thu, 11 Dec 2025 19:05:25 +0100 Subject: [PATCH] bugfix: more QT checking - check for QT_QPA_PLATFORMTHEME=qt6ct - make plasma-changeicons optional --- common/night-theme-switcher.in | 37 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/common/night-theme-switcher.in b/common/night-theme-switcher.in index a9b6f53..6c8ab79 100755 --- a/common/night-theme-switcher.in +++ b/common/night-theme-switcher.in @@ -51,6 +51,28 @@ readonly all_off bold blue green red yellow ### End insert of Arch script # dependency checks probably not needed but they do not hurt +if [ ! "$QT_QPA_PLATFORMTHEME" == "qt6ct" ]; then + notify-send \ + 'Wrong environment variable' \ + 'Please set QT_QPA_PLATFORMTHEME=qt6ct.' \ + -h string:x-canonical-private-synchronous:sys-notify \ + -u critical \ + -i dialog-error + mesg="environment variable QT_QPA_PLATFORMTHEME=qt6ct is not set." + echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}" + exit 1 +fi +if ! command -v breeze-settings6 >/dev/null 2>&1; then + notify-send \ + 'Missing dependency' \ + 'Please install breeze.' \ + -h string:x-canonical-private-synchronous:sys-notify \ + -u critical \ + -i dialog-error + mesg="breeze is required to use this script." + echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}" + exit 1 +fi if ! command -v qt6ct >/dev/null 2>&1; then notify-send \ 'Missing dependency' \ @@ -74,17 +96,6 @@ if ! command -v gsettings >/dev/null 2>&1; then echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}" exit 1 fi -if ! command -v /usr/lib/plasma-changeicons >/dev/null 2>&1; then - notify-send \ - 'Missing dependency' \ - 'plasma-changeicons not found.\nPlease install plasma-workspace.' \ - -h string:x-canonical-private-synchronous:sys-notify \ - -u critical \ - -i dialog-error - mesg="plasma-workspace is required to use this script." - echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}" - exit 1 -fi check_config() { if [[ ! -f $default_config_file ]]; then @@ -167,7 +178,9 @@ _set_theme() { gsettings set org.gnome.desktop.interface icon-theme "$icon_theme" ## QT - /usr/lib/plasma-changeicons "$icon_theme" >/dev/null 2>&1 + if [[ -x /usr/lib/plasma-changeicons ]]; then + /usr/lib/plasma-changeicons "$icon_theme" >/dev/null 2>&1 + fi if [[ -w "$HOME/.config/qt5ct/qt5ct.conf" ]]; then sed -i "s/icon_theme=.*/icon_theme=$icon_theme/g" \ "$HOME/.config/qt5ct/qt5ct.conf"