Skip to main content

Strava

Whatโ€‹

Strava is a popular activity tracker for bike, run or any other training. To keep up with your training goals it is important to be reminded about it. An Oh My Posh Strava segment shows your last activity, and can also indicate by a color if it is time to get away from your computer and get active.

Accessing your Strava dataโ€‹

To allow Oh My Posh access your Strava data you need to grant access to read your public activities. This will give you an access and a refresh token. Paste the tokens into your Strava segment configuration.

Click the following link to connect with Strava:

btn_strava_connectwith_orange

Sample Configurationโ€‹

This configuration sets the background green if you have an activity the last two days, orange if you have one last 5 days, and red otherwise. The foreground_templates example below could be set to just a single color, if that color is visible against any of your backgrounds.

{
"type": "strava",
"style": "powerline",
"powerline_symbol": "๎‚ฐ",
"foreground": "#ffffff",
"background": "#000000",
"background_templates": [
"{{ if gt .Hours 100 }}#dc3545{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}",
"{{ if lt .Hours 50 }}#28a745{{ end }}"
],
"foreground_templates": [
"{{ if gt .Hours 100 }}#FFFFFF{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}"
],
"template": " {{.Name}} {{.Ago}} {{.Icon}} ",
"properties": {
"access_token": "11111111111111111",
"refresh_token": "1111111111111111",
"http_timeout": 1500
}
}

Propertiesโ€‹

NameTypeDefaultDescription
access_tokenstringtoken from Strava login, see login link in section above.
refresh_tokenstringtoken from Strava login, see login link in section above.
expires_inint0the default timeout of the token from the Strava login
http_timeoutint500in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data?
cache_timeoutint5in minutes - How long do you want your Strava data cached?
ride_iconstring\uf206
run_iconstring\ue213
skiing_iconstring\ue213
workout_iconstring\ue213
unknown_activity_iconstring\ue213

Template (info)โ€‹

default template
{{ if .Error }}{{ .Error }}{{ else }}{{ .Ago }}{{ end }}

Propertiesโ€‹

The properties below are available for use in your template

NameTypeDescription
.IDtimeThe id of the entry
.DateStringtimeThe timestamp of the entry
.TypestringActivity types as used in strava
.UtcOffsetintThe UTC offset
.HoursintNumber of hours since last activity
.NamestringThe name of the activity
.Durationfloat64Total duration in seconds
.Distancefloat64Total distance in meters
.DeviceWattsboolDevice has watts
.AverageWattsfloat64Average watts
.WeightedAverageWattsfloat64Weighted average watts
.AverageHeartRatefloat64Average heart rate
.MaxHeartRatefloat64Max heart rate
.KudosCountintKudos count
.IconstringActivity based icon

Now, go out and have a fun ride or run!