From e56db14672be8e3e2f7e0d5e29fdac9e4057cbfb Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Mon, 22 Jul 2024 11:39:29 +0300 Subject: [PATCH] darkman & profile: use Kvantum for Qt dark mode switching --- etc/profile.d/99-wayland.sh | 1 + .../dark-mode.d/00-do-not-repeat-yourself.sh | 20 +++++++++++++++++-- .../dark-mode.d/10-adwaita-breeze-dark.bash | 5 +++++ local/share/light-mode.d/10-breeze.bash | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/etc/profile.d/99-wayland.sh b/etc/profile.d/99-wayland.sh index f7604889..24363576 100644 --- a/etc/profile.d/99-wayland.sh +++ b/etc/profile.d/99-wayland.sh @@ -1,3 +1,4 @@ +export QT_STYLE_OVERRIDE=kvantum export QT_QPA_PLATFORMTHEME="kde" export GDK_BACKEND=wayland export QT_QPA_PLATFORM=wayland diff --git a/local/share/dark-mode.d/00-do-not-repeat-yourself.sh b/local/share/dark-mode.d/00-do-not-repeat-yourself.sh index 64aa7e10..3e9302be 100644 --- a/local/share/dark-mode.d/00-do-not-repeat-yourself.sh +++ b/local/share/dark-mode.d/00-do-not-repeat-yourself.sh @@ -1,7 +1,14 @@ if ! hash lsb_release 2> /dev/null; then ERRORMESSAGE="lsb_release was not found, the wallpaper scripts cannot figure out the distribution" echo $ERRORMESSAGE - #notify-send $ERRORMESSAGE + notify-send --app-name=darkman --icon=error $ERRORMESSAGE + exit 0 +fi + +if ! hash kvantummanager 2> /dev/null; then + ERRORMESSAGE="kvantummanager wasn't found, Qt theme switching won't work!" + echo $ERRORMESSAGE + notify-send --app-name="darkman" --icon=error $ERRORMESSAGE exit 0 fi @@ -17,5 +24,14 @@ if [[ "$DARKMANGET" == "dark" ]]; then elif [[ "$DARKMANGET" == "light" ]]; then (notify-send --app-name="darkman" --urgency=low --icon=weather-clear "Teema: $DARKMANGET" &) else - echo "darkman: Something went wrong?" + ERRORMESSAGE="Something went wrong?" + echo $ERRORMESSAGE + notify-send --app-name="darkman" --icon=error $ERRORMESSAGE +fi + +if [[ "$QT_STYLE_OVERRIDE" != "kvantum" ]]; then + ERRORMESSAGE="\$QT_STYLE_OVERRIDE is not 'kvantum', Qt theme switching has no effect!" + echo $ERRORMESSAGE + notify-send --app-name="darkman" --icon=error $ERRORMESSAGE + exit 0 fi diff --git a/local/share/dark-mode.d/10-adwaita-breeze-dark.bash b/local/share/dark-mode.d/10-adwaita-breeze-dark.bash index 4ad80a19..6c17d173 100755 --- a/local/share/dark-mode.d/10-adwaita-breeze-dark.bash +++ b/local/share/dark-mode.d/10-adwaita-breeze-dark.bash @@ -1,5 +1,7 @@ #!/usr/bin/env bash +. ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.sh + # This is all adapted from /usr/share/doc/darkman/examples/dark-mode.d/ # GTK Theme @@ -12,3 +14,6 @@ # Plasma (lookandfeeltool --apply "org.kde.breezedark.desktop" &) + +# Kvantum Qt +(kvantummanager --set KvGnomeDark &) diff --git a/local/share/light-mode.d/10-breeze.bash b/local/share/light-mode.d/10-breeze.bash index 1724be0c..677b706c 100755 --- a/local/share/light-mode.d/10-breeze.bash +++ b/local/share/light-mode.d/10-breeze.bash @@ -1,5 +1,7 @@ #!/usr/bin/env bash +. ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.sh + # This is all adapted from /usr/share/doc/darkman/examples/light-mode.d/ # GTK Theme @@ -12,3 +14,6 @@ # Plasma (lookandfeeltool --apply "org.kde.breeze.desktop" &) + +# Kvantum Qt +(kvantummanager --set KvGnome &)