diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-08 20:21:22 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-08 20:21:22 +0900 |
| commit | c1483f53a3c3ab090fdc12e4f4afbb326c615267 (patch) | |
| tree | 040a9e8e4ade78bbda97bc6be6ec6a8ea2409b49 /config/hypr/UserScripts/WallpaperSelect.sh | |
| parent | 8ee53b6a3a53cf3ae7828d03dda5d62f7963b1d6 (diff) | |
fixed wallpaper scripts where it asked to apply to sddm even if user decided to cancel
Diffstat (limited to 'config/hypr/UserScripts/WallpaperSelect.sh')
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index feae485b..19bb145d 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -4,7 +4,6 @@ # WALLPAPERS PATH terminal=kitty - wallDIR="$HOME/Pictures/wallpapers" SCRIPTSDIR="$HOME/.config/hypr/scripts" wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" @@ -99,6 +98,7 @@ main() { echo "Image not found." exit 1 fi + } # Check if rofi is already running @@ -115,26 +115,31 @@ wait $! sleep 2 "$SCRIPTSDIR/Refresh.sh" -sleep 3 # add delay of 3 seconds for those who have slow machines -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 +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 a background process - 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_current '$sddm_sequoia/backgrounds/default' && \ - notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" + # 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_current '$sddm_sequoia/backgrounds/default' && \ + notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" break - elif echo "$line" | grep -q "no"; then + elif echo "$line" | grep -q "no"; then + echo "Wallpaper not set as SDDM background. Exiting." break - fi - done & + fi + done & + fi fi + |
