Skip to content

Instantly share code, notes, and snippets.

@zikes
Created Jul 6, 2018
Embed
What would you like to do?
Powerlevel9k + Google Play Music Desktop Player Custom Segment
zsh_gpmdp_now_playing(){
local json_file="$HOME/.config/Google Play Music Desktop Player/json_store/playback.json"
local is_playing=$(cat "$json_file" | jq '.playing')
local artist=$(cat "$json_file" | jq -r '.song.artist')
local title=$(cat "$json_file" | jq -r '.song.title')
if [[ "$is_playing" == "true" ]]; then
echo -n "\ufc58 $artist - $title"
fi
}
POWERLEVEL9K_CUSTOM_NOW_PLAYING='zsh_gpmdp_now_playing'
POWERLEVEL9K_CUSTOM_NOW_PLAYING_BACKGROUND='blue'
POWERLEVEL9K_CUSTOM_NOW_PLAYING_FOREGROUND='white'
@zikes
Copy link
Author

zikes commented Jul 6, 2018

https://www.googleplaymusicdesktopplayer.com/
https://github.com/bhilburn/powerlevel9k
https://stedolan.github.io/jq/

Add to prompt elements as custom_now_playing, e.g.

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs custom_now_playing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment