New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide battery segment when no information. #26
Comments
I could add a switch to the properties which would allow this. For example: "hide_error": true Not sure if I want to make a general switch, I do get where you're coming from but it can get confusing. What's also an option is to remove the segment from the theme altogether. A quick copy-paste, adjust and setting that as the theme will also hide it forever. Although that might take away its portability. |
I get your point about the general switch as it may open a can of worms. I like the idea of being able to dynamically determine visibility of a segment based on condition but embedding PowerShell code in JSON is quite ugly and no point in creating your own DSL for this 😀 |
@JanDeDobbeleer, one use case for a general switch or config setting for segment visibility is the following: Say I want to add an 💾 indicator in my prompt to show that |
You could achieve that with a custom command segment. That one accepts a shell command (and the shell to run it in, here being powershell) . If the command outputs a value, it will show that value. |
I created a theme ( https://gist.github.com/AjayKMehta/1b5324a485a9db6e7d326276ab5786cf The command is specified as It seems to run the command the first time and not work subsequently. Even if I disable saving via Any help would be appreciated. Thanks. |
It should not save state but run the command every time. I'll check! |
I can reproduce this. As this is ran on a new instance of |
Thanks. That's what I figured as I tried changing the command to |
Be aware the new version is now known as Oh my Posh V3 :-)
|
First of all, ❤️ this module! Finally switched over from
oh-my-posh
🙂I like your default theme (jandedobbeleer) but it shows "BATT ERR" on my desktop because no battery info, of course. IMHO it's better to not display the segment if no info but others may disagree.
To cater for both cases, it would be great if you could optionally specify a condition (scriptblock that returns boolean for example) for each segment in the JSON config that determines if the segment gets displayed or not.
The text was updated successfully, but these errors were encountered: