feat: add hyprland sound system with event-triggered audio feedback;
feat: implement new hyprland plugins (hyprfocus, hyprbars, dynamic-cursors); refactor: reorganize hyprland autostart with delay staging and plugin configuration; feat: add notification urgency-based sound system to swaync; feat: enhance waybar with battery module, mpd controls, and dock bar; refactor: update waybar taskbar with active window indicators and sorting; feat: add hyprland shutdown sound and login audio greeting; fix: adjust cava sleep timer and mpd sticker database configuration; feat: update rmpc keybindings for improved playlist management; fix: modify rofi keybindings for better navigation; chore: add zsh aliases and misspell corrections; refactor: update styling across swaync, waybar, and hyprland with new border radii and accent colors.
This commit is contained in:
@@ -5,29 +5,42 @@ if [ $(swaync-client --get-dnd) == "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Directory containing your notification sounds
|
||||
SOUND_DIR="$HOME/.config/swaync/scripts/sounds"
|
||||
SOUND_LOW_DIR="$HOME/.config/swaync/scripts/sounds/low"
|
||||
SOUND_NORMAL_DIR="$HOME/.config/swaync/scripts/sounds/normal"
|
||||
SOUND_CRITICAL_DIR="$HOME/.config/swaync/scripts/sounds/critical"
|
||||
|
||||
case $1 in
|
||||
low)
|
||||
DIR=$SOUND_LOW_DIR
|
||||
;;
|
||||
normal)
|
||||
DIR=$SOUND_NORMAL_DIR
|
||||
;;
|
||||
critical)
|
||||
DIR=$SOUND_CRITICAL_DIR
|
||||
;;
|
||||
*)
|
||||
echo "Unknown urgency level '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Enable nullglob to prevent literal interpretation when no files match
|
||||
shopt -s nullglob
|
||||
|
||||
# Get a list of audio files in the directory (simpler approach)
|
||||
SOUND_FILES=()
|
||||
for ext in wav mp3 ogg flac; do
|
||||
SOUND_FILES+=("$SOUND_DIR"/*."$ext")
|
||||
SOUND_FILES+=("$DIR"/*."$ext")
|
||||
done
|
||||
|
||||
# Check if any sound files exist
|
||||
if [ ${#SOUND_FILES[@]} -eq 0 ]; then
|
||||
echo "No sound files found in $SOUND_DIR"
|
||||
exit 0 # Exit with success so notifications still work
|
||||
echo "No sound files found in $SOUND_NORMAL_DIR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Select a random sound file
|
||||
RANDOM_INDEX=$((RANDOM % ${#SOUND_FILES[@]}))
|
||||
RANDOM_SOUND="${SOUND_FILES[$RANDOM_INDEX]}"
|
||||
|
||||
# Play the random sound
|
||||
play -v 0.5 "$RANDOM_SOUND" 2>/dev/null || {
|
||||
echo "Failed to play $RANDOM_SOUND"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user