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

45 lines
1 KiB
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
2023-03-31 11:55:36 -07:00
import Config from '@site/src/components/Config.js';
<Config data={{
2020-10-05 02:33:12 -07:00
"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",
"template": "{{ if .SSHSession }}\ueba9 {{ end }}{{ .UserName }}"
2023-03-31 11:55:36 -07:00
}}/>
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 }}\ueba9 {{ end }}{{ .UserName }}@{{ .HostName }}
2022-02-01 03:10:46 -08:00
```
:::
### Properties
| Name | Type | Description |
| ------------- | --------- | -------------------------------- |
| `.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