Last active
August 30, 2022 21:14
-
-
Save NTag/78a5d726a120147fbc55 to your computer and use it in GitHub Desktop.
Display Deezer played track in tmux powerline segment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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