From 8809b09f04e9f1af52d0fbf55946527f5d8995cc Mon Sep 17 00:00:00 2001 From: Linxford Kwabena Date: Sun, 12 May 2024 12:38:07 +0000 Subject: [PATCH] Update RofiBeats.sh Added option to list all supported music formats (mp3, ogg, wav, flac, m4a, wma,mp4) for local files. --- config/hypr/UserScripts/RofiBeats.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 5620f66..010d5f7 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -6,10 +6,12 @@ iDIR="$HOME/.config/swaync/icons" # Define menu options as associative arrays for local and online music declare -A local_music -# Populate the menu_options array with music files from the Music folder -for file in ~/Music/*.mp3; do - filename=$(basename "$file") - local_music["$filename"]="$file" +# Populate the menu_options array with music files from the Music folder with specified extensions +for file in ~/Music/*.{mp3,ogg,wav,flac,m4a,wma,mp4}; do + if [ -f "$file" ]; then + filename=$(basename "$file") + local_music["$filename"]="$file" + fi done @@ -67,7 +69,6 @@ play_online_music() { # Check if an online music process is running and send a notification, otherwise run the main function pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { - # Prompt the user to choose between local and online music user_choice=$(printf "Play from Music Folder\nOnline Streaming" | rofi -dmenu -p "Select music source") @@ -83,4 +84,3 @@ pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { ;; esac } -