diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-01-24 14:24:44 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-01-24 14:24:44 +0100 |
commit | da8c4b7b65235909b7c03da480689d9d871f8d59 (patch) | |
tree | 5dbcadd5a70c172eed8300efec727552eae89301 /musicMode.sh | |
parent | 95aa68aeb4b629e9a98a9a480a558b757b2a732e (diff) | |
download | scripts-da8c4b7b65235909b7c03da480689d9d871f8d59.tar.gz scripts-da8c4b7b65235909b7c03da480689d9d871f8d59.zip |
Created music mode and added some other little stuff.
Diffstat (limited to 'musicMode.sh')
-rwxr-xr-x | musicMode.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/musicMode.sh b/musicMode.sh new file mode 100755 index 0000000..4fd7c82 --- /dev/null +++ b/musicMode.sh @@ -0,0 +1,24 @@ +#!/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 +# Get file name +file="" +i3-msg "workspace 6" >/dev/null #Switch to music workspace +i3-msg "gaps inner current set 0; gaps outer current set 0; bar mode hide" +i3-msg "exec urxvt -title 'noborder' -sh 100 -fn xft:monospace:size=4 -e vis -c ~/.config/vis/configMusicMode" # Start music visualizer +# Loop checking current song and checking background +coverPath="/home/inigo/images/musicMode/cover.jpg" +while [ true ] +do + if [ "$file" != "$(cmus-remote -Q | grep "^file" | cut -d' ' -f2-)" ]; then + file="$(cmus-remote -Q | grep ^file | cut -d' ' -f2-)" + rm $coverPath >/dev/null + title="$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)" + [ -z "$title" ] && title="[$(basename "$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)")]" + 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 + fi +done |