Skip to content

Instantly share code, notes, and snippets.

@KaliumPuceon
Created July 1, 2017 14:55
Show Gist options
  • Save KaliumPuceon/0615e3d6faf3a771c6aa323d0aed0ee2 to your computer and use it in GitHub Desktop.
Save KaliumPuceon/0615e3d6faf3a771c6aa323d0aed0ee2 to your computer and use it in GitHub Desktop.
very simple shell script to get nowplaying from cmus and show in tmux status bar
# Stick this in your .tmux.conf somewhere
# This will override your current date setting if you have one though
# So modify to show other things I guess? This was for me really.
set -g status-right "#(nowplaying.sh) | #[bold]%d %b#[nobold] | %H:%M "
set -g status-right-length 120
set -g status-left-length 80
set -g status-interval 2 # Update bar regularly even without focus
#!/bin/bash
# put this in a PATH'd folder.
# I recommend ~/.local/bin
if pgrep -x "cmus" > /dev/null # is cmus running
then
START=$(cmus-remote -C status | grep "tag\ title" | head -n 1 | cut -d ' ' -f 3-)
END=$(cmus-remote -C status | grep "tag\ artist" | head -n 1 | cut -d ' ' -f 3-)
PLAYING=${START:0:60}" - "${END:0:40}
else
echo "cmus off"
fi
echo $PLAYING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment