From e7d59e49793442481705f0a8bb1d24ccea30eb8f Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 14 Feb 2019 08:11:39 +0100 Subject: Music mode now plays videoclip if it exists. --- closeMusicMode.sh | 2 +- musicMode.sh | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/closeMusicMode.sh b/closeMusicMode.sh index 620f667..a07cf00 100755 --- a/closeMusicMode.sh +++ b/closeMusicMode.sh @@ -1,5 +1,5 @@ #!/bin/sh kill $(pgrep -x musicMode.sh) # End the music mode process i3-msg "bar mode dock" # Restore the i3bar -exec feh --bg-fill ~/images/wallpapers/bg* # Restore default wallpaper +exec feh --bg-max ~/images/wallpapers/bg* # Restore default wallpaper notify-send -h string:x-canonical-private-synchronous:musicMode -t 1000 "Closed music mode." diff --git a/musicMode.sh b/musicMode.sh index e634aee..574a58d 100755 --- a/musicMode.sh +++ b/musicMode.sh @@ -1,7 +1,7 @@ #!/bin/sh [ "$(pgrep -x musicMode.sh)" != "$$" ] && notify-send -t 3000 "Already running! Exiting this new instance." && exit 0 #Check if already running -[ -z "$(pgrep -x cmus)" ] && notify-send -t 3000 "cmus not running: No music mode." && exit 0 #Check that cmus is running +[ -z "$(pgrep -x cmus)" ] && notify-send -t 3000 "cmus not running. Open it first." && exit 0 #Check that cmus is running mkdir /tmp/musicMode coverPath="/tmp/musicMode/cover.jpg" @@ -22,6 +22,17 @@ do notify-send -h string:x-canonical-private-synchronous:musicMode -t 0 "$(~/scripts/i3blocks/i3music.sh)" ffmpeg -i "$file" $coverPath >/dev/null feh --no-fehbg --bg-max $coverPath >/dev/null - sleep 1 + videoFile="$(ls -d ~/videos/music/* | grep "$title")" + if [ "$videoFile" ]; then # videoclip found + cmus-remote -u + mpv --fs "$videoFile" + while [ "$(pgrep -x mpv)" ] + do + sleep 1 + done + cmus-remote -n + fi fi + [ -z "$(pgrep -x cmus)" ] && notify-send "Cmus closed." && closeMusicMode.sh + sleep 1 done -- cgit v1.2.1