aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay@gmail.com>2024-05-20 17:27:21 +0900
committerJaKooLit <jimmielovejay@gmail.com>2024-05-20 17:27:21 +0900
commit8f5c2af4cff0e5fae763e3f65b2cf90bacc85647 (patch)
tree7cb484a4564b901972c4ee9238e4ce6c0d09a036
parent38e957e52a854299437d3780d954a249006b257e (diff)
Tweaked Rofi Beats
-rwxr-xr-xconfig/hypr/UserScripts/RofiBeats.sh34
1 files changed, 18 insertions, 16 deletions
diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh
index 04af7222..7fed687f 100755
--- a/config/hypr/UserScripts/RofiBeats.sh
+++ b/config/hypr/UserScripts/RofiBeats.sh
@@ -1,12 +1,14 @@
#!/bin/bash
+# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
+# For Rofi Beats to play online Music or Locally save media files
-# Directory music folder
+# Directory local music folder
mDIR="$HOME/Music/"
# Directory for icons
iDIR="$HOME/.config/swaync/icons"
-# Online Stations
+# Online Stations. Edit as required
declare -A online_music=(
["AfroBeatz 2024 🎧"]="https://www.youtube.com/watch?v=7uB-Eh9XVZQ"
["Lofi Girl ☕️🎶"]="https://play.streamafrica.net/lofiradio"
@@ -22,7 +24,6 @@ declare -A online_music=(
["Korean Drama OST 📻🎶"]="https://youtube.com/playlist?list=PLUge_o9AIFp4HuA-A3e3ZqENh63LuRRlQ"
)
-# Local Music
# Populate local_music array with files from music directory and subdirectories
populate_local_music() {
local_music=()
@@ -52,13 +53,14 @@ play_local_music() {
# Find the corresponding file path based on user's choice and set that to play the song then continue on the list
for (( i=0; i<"${#filenames[@]}"; ++i )); do
if [ "${filenames[$i]}" = "$choice" ]; then
+
+ notification "$choice"
- notification "$choice"
# For some reason wont start playlist at 0
if [[ $i -eq 0 ]]; then
# Play the selected local music file using mpv
- mpv --loop-playlist --vid=no "$mDIR"
-
+ mpv --loop-playlist --vid=no "$mDIR"
+
else
file=$i
# Play the selected local music file using mpv
@@ -69,6 +71,14 @@ play_local_music() {
done
}
+# Main function for shuffling local music
+shuffle_local_music() {
+ notification "Shuffle local music"
+
+ # Play music in $mDIR on shuffle
+ mpv --shuffle --loop-playlist --vid=no "$mDIR"
+}
+
# Main function for playing online music
play_online_music() {
choice=$(printf "%s\n" "${!online_music[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Online Music")
@@ -85,19 +95,11 @@ 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 --loop-playlist --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" "Music stopped" || {
# Prompt the user to choose between local and online music
-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")
+user_choice=$(printf "Play from Online Stations\nPlay from Music Folder\nShuffle Play 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")
@@ -106,7 +108,7 @@ user_choice=$(printf "Play from Online Stations\nPlay from Music Folder\nShuffle
"Play from Online Stations")
play_online_music
;;
- "Shuffle from Music Folder")
+ "Shuffle Play from Music Folder")
shuffle_local_music
;;
*)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage