Skip to main content

YouTube Music

Whatโ€‹

Shows the currently playing song in the YouTube Music Desktop App.

Setupโ€‹

You need to enable the Companion API in the YouTube Music Desktop App settings. To do this, open the app, go to Settings > Integration and enable the following:

  • Companion server
  • Enable companion authentication

From the CLI, run the following command to set the authentication token:

oh-my-posh auth ytmda

If done correctly, you should now be able to add the ytm segment to your prompt.

rate limiting

The YouTube Music Desktop App has a pretty strict rate limit. Therefore it is recommended to set the cache property in your configuration. If you don't, the segment will not be able to display correctly.

Sample Configurationโ€‹

{
"type": "ytm",
"style": "powerline",
"powerline_symbol": "๎‚ฐ",
"foreground": "#ffffff",
"background": "#FF0000",
"options": {
"playing_icon": "๏‹ ",
"paused_icon": "๏Œ ",
"stopped_icon": "๏ ",
"ad_icon": "๎บป ",
"http_timeout": 1000
},
"cache": {
"duration": "5s",
"strategy": "session"
}
}

Optionsโ€‹

NameTypeDefaultDescription
playing_iconstring\uf04b text/icon to show when playing
paused_iconstring\uf04c text/icon to show when paused
stopped_iconstring\uf04d text/icon to show when stopped
ad_iconstring\ueebb text/icon to show when an advertisement is playing
http_timeoutint5000in milliseconds - the timeout for http request

Template (info)โ€‹

default template
{{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }}

Propertiesโ€‹

NameTypeDescription
.Statusstringplayer status (playing, paused, stopped)
.Artiststringcurrent artist
.Trackstringcurrent track
.Iconstringicon (based on .Status)