Skip to content

Instantly share code, notes, and snippets.

@MoOmEeN
Created January 9, 2017 22:47
Show Gist options
  • Save MoOmEeN/2f0e10415b37c2763275a8e0573b2d79 to your computer and use it in GitHub Desktop.
Save MoOmEeN/2f0e10415b37c2763275a8e0573b2d79 to your computer and use it in GitHub Desktop.
Show now playing song from spotify in tmux powerline on elementary linux
__np_spotify_elementary() {
[ ! shell_is_linux ] && return 1
spotify_ids=$(xwininfo -root -tree | grep '("spotify' | cut -f1 -d'"' | sed 's/ //g')
for spotify_id in $spotify_ids
do
title=$(xwininfo -id "$spotify_id" | grep "xwininfo" | grep -Po "(?<=\").*(?=\"$)")
if [ "$title" != "spotify" ]; then
echo $title
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment