oh-my-posh/website/docs/segments/session.mdx

43 lines
801 B
Plaintext
Raw Normal View History

2020-10-05 02:33:12 -07:00
---
id: session
title: Session
sidebar_label: Session
---
## What
Show the current user and host name.
## Sample Configuration
```json
{
"type": "session",
"style": "diamond",
2020-10-05 02:33:12 -07:00
"foreground": "#ffffff",
"background": "#c386f1",
2020-10-16 08:12:34 -07:00
"leading_diamond": "\uE0B6",
2021-12-03 14:44:58 -08:00
"trailing_diamond": "\uE0B0",
2022-03-27 01:12:47 -07:00
"template": "{{ if .SSHSession }}\uF817 {{ end }}{{ .UserName }}"
2020-10-05 02:33:12 -07:00
}
```
2022-02-01 03:10:46 -08:00
## Template ([info][templates])
:::note default template
``` template
{{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }}@{{ .HostName }}
```
:::
### Properties
- `.UserName`: `string` - the current user's name
- `.HostName`: `string` - the current computer's name
- `.SSHSession`: `boolean` - active SSH session or not
- `.Root`: `boolean` - are you a root/admin user or not
2022-04-20 09:43:59 -07:00
[templates]: /docs/configuration/templates