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",
|
2022-01-17 04:16:04 -08:00
|
|
|
"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
|
2021-02-15 03:53:28 -08:00
|
|
|
|
|
|
|
- `.UserName`: `string` - the current user's name
|
2022-01-17 04:16:04 -08:00
|
|
|
- `.HostName`: `string` - the current computer's name
|
2021-02-15 03:53:28 -08:00
|
|
|
- `.SSHSession`: `boolean` - active SSH session or not
|
2021-02-15 13:01:09 -08:00
|
|
|
- `.Root`: `boolean` - are you a root/admin user or not
|
2021-02-15 03:53:28 -08:00
|
|
|
|
2022-04-20 09:43:59 -07:00
|
|
|
[templates]: /docs/configuration/templates
|