Skip to content

Instantly share code, notes, and snippets.

@NTag
Last active August 30, 2022 21:14
Show Gist options
  • Save NTag/78a5d726a120147fbc55 to your computer and use it in GitHub Desktop.
Save NTag/78a5d726a120147fbc55 to your computer and use it in GitHub Desktop.
Display Deezer played track in tmux powerline segment
# Display current played track by Deezer Application
generate_segmentrc() {
read -d '' rccontents << EORC
EORC
echo "${rccontents}"
}
run_segment() {
infos=$(osascript -e '
if application "Deezer" is running then
tell application "Deezer"
local ttitle
local tartist
if (player state = playing) then
set ttitle to (get title of loaded track)
set tartist to (get artist of loaded track)
ttitle & " - " & tartist
end if
end tell
end if')
if [ ! -z "$infos" ]
then
infos=`echo $infos | sed -e 's/(.*)//g' | sed -e 's/ */ /g'`
echo "♫ $infos"
return 0
fi
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment