Browse Source

Check arguments before initialise Sounds.sh

pull/142/head
KKV9 2 years ago
parent
commit
a12faec054
  1. 20
      config/hypr/UserScripts/Sounds.sh

20
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

Loading…
Cancel
Save