Skip to content

Instantly share code, notes, and snippets.

@zikes
Created July 6, 2018 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zikes/cc688bdab05cdce426dd7b56a10af8c8 to your computer and use it in GitHub Desktop.
Save zikes/cc688bdab05cdce426dd7b56a10af8c8 to your computer and use it in GitHub Desktop.
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