Last active
October 25, 2015 21:17
-
-
Save megalithic/cd957de7c6905e8bb2c3 to your computer and use it in GitHub Desktop.
Radiant Player "now playing" applescript; for use with tmux or other CLI applications
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
#!/usr/bin/env sh | |
NOW_PLAYING=$(osascript <<EOF | |
if app_is_running("Radiant Player") then | |
tell application "Radiant Player" | |
set artist to current song artist | |
set track to current song name | |
set state to player state | |
if state is 1 then | |
-- paused | |
return "#[fg=colour240] ♫ - paused #[fg=default]" | |
else if state is 2 then | |
-- playing | |
return "#[fg=red] ♫ " & track & " - " & artist & "#[fg=default]" | |
else if state is 0 then | |
if artist is missing value then | |
-- stopped | |
return "" | |
else | |
-- status isn\'t coming across correctly | |
return "#[fg=red] ♫ " & track & " - " & artist & "#[fg=default]" | |
end | |
end if | |
end tell | |
end if | |
on app_is_running(app_name) | |
tell app "System Events" to (name of processes) contains app_name | |
end app_is_running | |
EOF) | |
echo $NOW_PLAYING |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Now Playing" track info for Radiant Player
I use this as part of my tmux status, just be sure to
chmod +x
this script so that it will execute.Here is an example of how i use this in my tmux.conf:
set -g status-right "#(~/.dotfiles/bin/radiant)"
Should be super simple to modify/adapt to whatever app you're using as long as the app supports applescript.
Enjoy!