Closed charlesroper closed 3 years ago
@charlesroper do you know a command to get this information from within the WSL instance?
@charlesroper sounds like this is held in the environment variable $WSL_DISTRO_NAME
which you can confirm using the command echo $WSL_DISTRO_NAME
With that in mind, you should be able to display this in your prompt by adding a envvar
segment to your theme. envvar docs here
Superb, thank you! I didn't think of using an environment var. I've customised my local copy of the negligible theme to include the distro name. Screenshot and content of theme file below.
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "os",
"style": "plain",
"foreground": "green",
"properties": {
"wsl": "",
"wsl_separator": "",
"prefix": "[",
"postfix": " "
}
},
{
"type": "envvar",
"style": "plain",
"powerline_symbol": "\uE0B0",
"foreground": "green",
"properties": {
"var_name": "WSL_DISTRO_NAME",
"prefix": "",
"postfix": "]"
}
},
{
"type": "path",
"style": "plain",
"foreground": "cyan",
"properties": {
"style": "full"
}
},
{
"type": "git",
"style": "plain",
"foreground": "lightYellow",
"properties": {
"prefix": ":: <lightBlue>git(</>",
"postfix": "<lightBlue>)</>"
}
}
]
},
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "python",
"style": "plain",
"foreground": "lightRed",
"properties": {
"display_virtual_env": true,
"display_version": false,
"prefix": "[ ",
"postfix": " ]",
"display_mode": "always"
}
},
{
"type": "time",
"style": "plain",
"foreground": "lightGreen"
}
]
},
{
"type": "newline"
},
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "exit",
"style": "powerline",
"foreground": "lightGreen",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "red",
"prefix": "\u279c"
}
}
]
}
]
}
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
I run a number of WSL distros of the same type (Ubuntu 20.04 mainly) for different projects by cloning and renaming my base distro (see instructions here). It would be very useful to be able to display the WSL distro name as a segment rather than just the OS name/logo. Is this possible? Many thanks.
Environment