From 239e30d295bf7a58e2ac00a79d959704b3ba8fe1 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 19 Feb 2025 13:27:11 +0900 Subject: added a function to check first if kitty installed. This is a idiot notification who uninstall kitty and complain that script wont work --- config/hypr/UserScripts/WallpaperEffects.sh | 54 +++++++++++++++++------------ 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'config/hypr/UserScripts/WallpaperEffects.sh') diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh index 52cd0b4d..dea97921 100755 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -103,26 +103,34 @@ main sleep 1 # Check if user selected a wallpaper if [[ -n "$choice" ]]; then - sddm_sequoia="/usr/share/sddm/themes/sequoia_2" - if [ -d "$sddm_sequoia" ]; then - notify-send -i "$iDIR/ja.png" "Set wallpaper" "as SDDM background?" \ - -t 10000 \ - -A "yes=Yes" \ - -A "no=No" \ - -h string:x-canonical-private-synchronous:wallpaper-notify - - # Wait for user input using dbus-monitor - dbus-monitor "interface='org.freedesktop.Notifications',member='ActionInvoked'" | - while read -r line; do - if echo "$line" | grep -q "yes"; then - $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ - sudo cp -r $wallpaper_output '$sddm_sequoia/backgrounds/default' && \ - notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" - break - elif echo "$line" | grep -q "no"; then - echo "Wallpaper not set as SDDM background. Exiting." - break - fi - done & - fi -fi + sddm_sequoia="/usr/share/sddm/themes/sequoia_2" + if [ -d "$sddm_sequoia" ]; then + notify-send -i "$iDIR/ja.png" "Set wallpaper" "as SDDM background?" \ + -t 10000 \ + -A "yes=Yes" \ + -A "no=No" \ + -h string:x-canonical-private-synchronous:wallpaper-notify + + # Wait for user input using dbus-monitor + dbus-monitor "interface='org.freedesktop.Notifications',member='ActionInvoked'" | + while read -r line; do + if echo "$line" | grep -q "yes"; then + + # Check if terminal exists + if ! command -v "$terminal" &>/dev/null; then + notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" + exit 1 + fi + + $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ + sudo cp -r $wallpaper_output '$sddm_sequoia/backgrounds/default' && \ + notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" + break + elif echo "$line" | grep -q "no"; then + echo "Wallpaper not set as SDDM background. Exiting." + break + fi + + done & + fi +fi \ No newline at end of file -- cgit v1.2.3