JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.02k stars 2.37k forks source link

Display WSL2 Ubuntu Version #1384

Closed earlev4 closed 2 years ago

earlev4 commented 2 years ago

Code of Conduct

What would you like to see changed/added?

Good day! Thank you very, very much to @JanDeDobbeleer and the contributors of this excellent project! Your efforts and hard work are truly appreciated! I am new to oh-my-posh and quickly became a huge fan. I am running oh-my-posh on PowerShell and WSL2.

Currently, I am running two versions of WSL2 Ubuntu (18.04 and 20.04). I am hoping in a future release of oh-my-posh that the version of WSL2 Ubuntu could be added to the prompt. Often I am working in two sessions and have to run lsb_release -a to identify the release that I am working in. I suppose I could alter the config or change the background to differentiate between the two releases but I am really pleased with settings I already have.

I searched 'Issues' and the closest request I found for this type of feature is #443. Please forgive the request if this functionality already exists and I overlooked it. As I mentioned, I am still new to oh-my-posh.

Just to note, I am using the powerlevel10k_rainbow.omp.json theme and the only portion that I changed was for Python. https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/powerlevel10k_rainbow.omp.json

        {
          "type": "python",
          "style": "powerline",
          "powerline_symbol": "",
          "invert_powerline": true,
          "foreground": "#111111",
          "background": "#FFDE57",
          "properties": {
            "postfix": " \uE235 ",
            "display_mode": "always",
            "fetch_virtual_env": true,
            "template": "{{ .Venv }}"
          }

Thanks so much! Again, I greatly appreciate the project.

JanDeDobbeleer commented 2 years ago

@earlev4 you could actually make use of the command segment to run that command and display the output. In case of an error, the segment isn't show. I'll see if we can make this a more permanent solution.

earlev4 commented 2 years ago

Hi @JanDeDobbeleer! I appreciate the quick and helpful response. Based on your feedback, I added the following code to the commandsegment and the release is now I showing in the prompt to the right of the Ubuntu icon:

        {
          "type": "command",
          "style": "diamond",
          "foreground": "#000000",
          "background": "#d3d7cf",
          "properties": {
            "shell": "bash",
            "command": "lsb_release -r -s"
          }

I will go ahead close the feature request.

Thanks so much! I sincerely appreciate your help and project!

github-actions[bot] commented 6 months ago

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.