aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/UserScripts')
-rwxr-xr-xconfig/hypr/UserScripts/RofiBeats.sh37
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperSelect.sh7
2 files changed, 26 insertions, 18 deletions
diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh
index b134c8a2..781e9f64 100755
--- a/config/hypr/UserScripts/RofiBeats.sh
+++ b/config/hypr/UserScripts/RofiBeats.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
-# For Rofi Beats to play online Music or Locally save media files
+# For Rofi Beats to play online Music or Locally saved media files
# Variables
mDIR="$HOME/Music/"
@@ -41,7 +41,7 @@ populate_local_music() {
# Function for displaying notifications
notification() {
- notify-send -u normal -i "$iDIR/music.png" " Now Playing:" " $@"
+ notify-send -u normal -i "$iDIR/music.png" "Now Playing:" "$@"
}
# Main function for playing local music
@@ -60,8 +60,6 @@ play_local_music() {
if [ "${filenames[$i]}" = "$choice" ]; then
notification "$choice"
-
- # Play the selected local music file using mpv
mpv --playlist-start="$i" --loop-playlist --vid=no "${local_music[@]}"
break
@@ -95,18 +93,30 @@ play_online_music() {
mpv --shuffle --vid=no "$link"
}
+# Function to stop music and kill mpv processes
+stop_music() {
+ mpv_pids=$(pgrep -x mpv)
-# 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" || {
+ if [ -n "$mpv_pids" ]; then
+ # Get the PID of the mpv process used by mpvpaper (using the unique argument added)
+ mpvpaper_pid=$(ps aux | grep -- 'unique-wallpaper-process' | grep -v 'grep' | awk '{print $2}')
-# Check if rofi is already running
-if pidof rofi > /dev/null; then
- pkill rofi
-fi
+ for pid in $mpv_pids; do
+ if ! echo "$mpvpaper_pid" | grep -q "$pid"; then
+ kill -9 $pid || true
+ fi
+ done
+ notify-send -u low -i "$iDIR/music.png" "Music stopped" || true
+ fi
+}
+# Check if music is already playing
+if pgrep -x "mpv" > /dev/null; then
+ stop_music
+else
+ user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuffle Play from Music directory" | rofi -dmenu -config $rofi_theme_1)
-# Prompt the user to choose between local and online music
-user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuffle Play from Music directory" | rofi -dmenu -config $rofi_theme_1)
+ echo "User choice: $user_choice"
case "$user_choice" in
"Play from Music directory")
@@ -119,7 +129,6 @@ user_choice=$(printf "Play from Online Stations\nPlay from Music directory\nShuf
shuffle_local_music
;;
*)
- echo "Invalid choice"
;;
esac
-}
+fi \ No newline at end of file
diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh
index 0816cd49..161611d8 100755
--- a/config/hypr/UserScripts/WallpaperSelect.sh
+++ b/config/hypr/UserScripts/WallpaperSelect.sh
@@ -46,7 +46,7 @@ rofi_override="element-icon{size:${adjusted_icon_size}%;}"
# Kill existing wallpaper daemons
kill_wallpaper_for_video() {
killall swww
- killall mpvpaper
+ killall mpvpaper
pkill swaybg
pkill hyprpaper
}
@@ -170,7 +170,6 @@ apply_image_wallpaper() {
set_sddm_wallpaper
}
-# Apply Video Wallpaper
apply_video_wallpaper() {
local video_path="$1"
@@ -181,8 +180,8 @@ apply_video_wallpaper() {
fi
kill_wallpaper_for_video
- # Apply video wallpaper using mpvpaper
- mpvpaper '*' -o "no-audio --loop" "$video_path" &
+ # Apply video wallpaper using mpvpaper, adding a unique argument
+ mpvpaper '*' -o "no-audio --loop --unique-wallpaper-process" "$video_path" &
}
# Main function
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage