1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2542],{9098(e,t,s){s.r(t),s.d(t,{assets:()=>a,contentTitle:()=>l,default:()=>x,frontMatter:()=>c,metadata:()=>n,toc:()=>o});const n=JSON.parse('{"id":"segments/health/strava","title":"Strava","description":"What","source":"@site/docs/segments/health/strava.mdx","sourceDirName":"segments/health","slug":"/segments/health/strava","permalink":"/docs/segments/health/strava","draft":false,"unlisted":false,"editUrl":"https://github.com/jandedobbeleer/oh-my-posh/edit/main/website/docs/segments/health/strava.mdx","tags":[],"version":"current","frontMatter":{"id":"strava","title":"Strava","sidebar_label":"Strava"},"sidebar":"docs","previous":{"title":"Ramadan","permalink":"/docs/segments/health/ramadan"},"next":{"title":"Withings","permalink":"/docs/segments/health/withings"}}');var d=s(4848),r=s(8453),i=s(6674);const c={id:"strava",title:"Strava",sidebar_label:"Strava"},l=void 0,a={},o=[{value:"What",id:"what",level:2},{value:"Accessing your Strava data",id:"accessing-your-strava-data",level:2},{value:"Sample Configuration",id:"sample-configuration",level:2},{value:"Options",id:"options",level:2},{value:"Template (info)",id:"template-info",level:2},{value:"Properties",id:"properties",level:3}];function h(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",img:"img",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,r.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(t.h2,{id:"what",children:"What"}),"\n",(0,d.jsxs)(t.p,{children:[(0,d.jsx)(t.a,{href:"http://www.strava.com/",children:"Strava"})," is a popular activity tracker for bike, run or any other training.\nTo keep up with your training goals it is important to be reminded about it.\nAn Oh My Posh Strava segment shows your last activity,\nand can also indicate by a color if it is time to get away from your computer and get active."]}),"\n",(0,d.jsx)(t.h2,{id:"accessing-your-strava-data",children:"Accessing your Strava data"}),"\n",(0,d.jsx)(t.p,{children:"To allow Oh My Posh access your Strava data you need to grant access to read your public activities.\nThis will give you an access and a refresh token. Paste the tokens into your Strava segment configuration."}),"\n",(0,d.jsx)(t.p,{children:"Click the following link to connect with Strava:"}),"\n",(0,d.jsx)(t.p,{children:(0,d.jsx)(t.a,{href:"https://www.strava.com/oauth/authorize?client_id=76033&response_type=code&redirect_uri=https://
1ohmyposh.dev/api/auth&approval_prompt=force&scope=read,activity:read&state=strava",children:(0,d.jsx)(t.img,{alt:"strava-connect",src:s(9937).A+"",width:"193",height:"48"})})}),"\n",(0,d.jsx)(t.h2,{id:"sample-configuration",children:"Sample Configuration"}),"\n",(0,d.jsxs)(t.p,{children:["This configuration sets the background green if you have an activity the last two days,\norange if you have one last 5 days, and red otherwise. The ",(0,d.jsx)(t.code,{children:"foreground_templates"})," example below could be set to just a single color,\nif that color is visible against any of your backgrounds."]}),"\n","\n",(0,d.jsx)(i.A,{data:{type:"strava",style:"powerline",powerline_symbol:"\ue0b0",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:" \ued52 {{.Name}} {{.Ago}} {{.Icon}} ",options:{access_token:"11111111111111111",refresh_token:"1111111111111111",http_timeout:1500}}}),"\n",(0,d.jsx)(t.h2,{id:"options",children:"Options"}),"\n",(0,d.jsxs)(t.table,{children:[(0,d.jsx)(t.thead,{children:(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.th,{children:"Name"}),(0,d.jsx)(t.th,{style:{textAlign:"center"},children:"Type"}),(0,d.jsx)(t.th,{style:{textAlign:"center"},children:"Default"}),(0,d.jsx)(t.th,{children:"Description"})]})}),(0,d.jsxs)(t.tbody,{children:[(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"access_token"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.a,{href:"/docs/configuration/templates",children:(0,d.jsx)(t.code,{children:"template"})})}),(0,d.jsx)(t.td,{style:{textAlign:"center"}}),(0,d.jsx)(t.td,{children:"token from Strava login, see login link in section above."})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"refresh_token"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.a,{href:"/docs/configuration/templates",children:(0,d.jsx)(t.code,{children:"template"})})}),(0,d.jsx)(t.td,{style:{textAlign:"center"}}),(0,d.jsx)(t.td,{children:"token from Strava login, see login link in section above."})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"expires_in"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"int"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"0"})}),(0,d.jsx)(t.td,{children:"the default timeout of the token from the Strava login"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"http_timeout"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"int"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"20"})}),(0,d.jsx)(t.td,{children:"in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data?"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"ride_icon"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"\\uf206"})}),(0,d.jsx)(t.td,{})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"run_icon"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"\\ue213"})}),(0,d.jsx)(t.td,{})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"skiing_icon"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"\\ue213"})}),(0,d.jsx)(t.td,{})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"workout_icon"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"\\ue213"})}),(0,d.jsx)(t.td,{})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"unknown_activity_icon"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{style:{textAlign:"center"},children:(0,d.jsx)(t.code,{children:"\\ue213"})}),(0,d.jsx)(t.td,{})]})]})]}),"\n",(0,d.jsxs)(t.h2,{id:"template-info",children:["Template (",(0,d.jsx)(t.a,{href:"/docs/configuration/templates",children:"info"}),")"]}),"\n",(0,d.jsx)(t.admonition,{title:"default template",type:"note",children:(0,d.jsx)(t.pre,{children:(0,d.jsx)(t.code,{className:"language-template",children:" {{ if .Error }}{{ .Error }}{{ else }}{{ .Ago }}{{ end }}\n"})})}),"\n",(0,d.jsx)(t.h3,{id:"properties",children:"Properties"}),"\n",(0,d.jsxs)(t.table,{children:[(0,d.jsx)(t.thead,{children:(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.th,{children:"Name"}),(0,d.jsx)(t.th,{children:"Type"}),(0,d.jsx)(t.th,{children:"Description"})]})}),(0,d.jsxs)(t.tbody,{children:[(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".ID"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"time"})}),(0,d.jsx)(t.td,{children:"The id of the entry"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".DateString"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"time"})}),(0,d.jsx)(t.td,{children:"The timestamp of the entry"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Type"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{children:"Activity types as used in strava"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".UtcOffset"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"int"})}),(0,d.jsx)(t.td,{children:"The UTC offset"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Hours"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"int"})}),(0,d.jsx)(t.td,{children:"Number of hours since last activity"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Name"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{children:"The name of the activity"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Duration"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Total duration in seconds"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Distance"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Total distance in meters"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".DeviceWatts"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"bool"})}),(0,d.jsx)(t.td,{children:"Device has watts"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".AverageWatts"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Average watts"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".WeightedAverageWatts"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Weighted average watts"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".AverageHeartRate"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Average heart rate"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".MaxHeartRate"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"float64"})}),(0,d.jsx)(t.td,{children:"Max heart rate"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".KudosCount"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"int"})}),(0,d.jsx)(t.td,{children:"Kudos count"})]}),(0,d.jsxs)(t.tr,{children:[(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:".Icon"})}),(0,d.jsx)(t.td,{children:(0,d.jsx)(t.code,{children:"string"})}),(0,d.jsx)(t.td,{children:"Activity based icon"})]})]})]}),"\n",(0,d.jsx)(t.p,{children:"Now, go out and have a fun ride or run!"})]})}function x(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,d.jsx)(t,{...e,children:(0,d.jsx)(h,{...e})}):h(e)}},9937(e,t,s){s.d(t,{A:()=>n});const n=s.p+"assets/images/strava_connect-d61a51baedcfa2ed12801e956175a0ba.svg"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.