From a12faec054ccdff3faec2f82390c3b39f3816036 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 18:44:54 +0000 Subject: [PATCH] Check arguments before initialise Sounds.sh --- config/hypr/UserScripts/Sounds.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index ef62e3f..99ec9da 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -10,6 +10,16 @@ if [[ "$muted" = true ]]; then exit 0 fi +# Choose the sound to play. +if [[ "$1" == "--shutter" ]]; then + soundoption="camera-shutter.*" +elif [[ "$1" == "--volume" ]]; then + soundoption="audio-volume-change.*" +else + echo -e "Available sounds: --shutter, --volume" + exit 0 +fi + # Set the directory defaults for system sounds. userDIR="$HOME/.local/share/sounds" systemDIR="/usr/share/sounds" @@ -27,16 +37,6 @@ fi iTheme=$(cat "$sDIR/index.theme" | grep -i "inherits" | cut -d "=" -f 2) iDIR="$sDIR/../$iTheme" -# Choose the sound to play. -if [[ "$1" == "--shutter" ]]; then - soundoption="camera-shutter.*" -elif [[ "$1" == "--volume" ]]; then - soundoption="audio-volume-change.*" -else - echo -e "Available sounds: --shutter, --volume" - exit 0 -fi - # Find the sound file and play it. sound_file=$(find $sDIR/stereo -name "$soundoption" -print -quit) if test -f "$sound_file"; then