Skip to content

Instantly share code, notes, and snippets.

@MoOmEeN
MoOmEeN / now_playing.sh
Created January 9, 2017 22:47
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