Skip to content

Commit

Permalink
Merge pull request #285 from darkeddie/development
Browse files Browse the repository at this point in the history
Add a Quick shuffle option to rofibeats
  • Loading branch information
JaKooLit committed May 20, 2024
2 parents 9a5fa86 + 56fc332 commit 0006e56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions config/hypr/UserScripts/RofiBeats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ play_online_music() {
mpv --shuffle --vid=no "$link"
}

# Main function for shuffling local music
shuffle_local_music() {
notification "Shuffle local music"

# Play music in $mDIR on shuffle
mpv --shuffle --vid=no "$mDIR"
}

# 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" || {
pkill mpv && notify-send -u low -i "$iDIR/music.png" "Music stopped" || {

# Prompt the user to choose between local and online music
user_choice=$(printf "Play from Online Stations\nPlay from Music Folder" | rofi -dmenu -config ~/.config/rofi/config-rofi-Beats-menu.rasi -p "Select music source")
user_choice=$(printf "Play from Online Stations\nPlay from Music Folder\nShuffle from Music Folder" | rofi -dmenu -config ~/.config/rofi/config-rofi-Beats-menu.rasi -p "Select music source")

case "$user_choice" in
"Play from Music Folder")
Expand All @@ -92,6 +100,9 @@ user_choice=$(printf "Play from Online Stations\nPlay from Music Folder" | rofi
"Play from Online Stations")
play_online_music
;;
"Shuffle from Music Folder")
shuffle_local_music
;;
*)
echo "Invalid choice"
;;
Expand Down
4 changes: 2 additions & 2 deletions config/rofi/config-rofi-Beats-menu.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ window {
listview {
fixed-columns: false;
colums: 1;
lines: 2;
}
lines: 3;
}

0 comments on commit 0006e56

Please sign in to comment.