falkecarlsen / poly-battery-status

status-bar script for multi-battery systems on Linux
0 stars 1 forks source link

Format output in a different way #2

Open joandrsn opened 4 years ago

joandrsn commented 4 years ago

It would be awesome if I could choose to format the output without the decimals, so instead of 85.00, it would just display 85.

Additionally, someone might want 85.0.

Maybe a commandline parameter could be set for the format wanted?

falkecarlsen commented 4 years ago

Nice idea :+1:

Generally, being able to format all output entirely according to preferences would be preferred. 42.0% (-2:20), candidates could be:

  1. decimals of percentage
  2. percentage-sign
  3. symbols surrounding time-to-completion
  4. charging/discharging symbol
  5. delimiter between hours and minutes

Which of these would you prefer to be able to modify?

falkecarlsen commented 4 years ago

Secondly, I'm in the process of porting this script into python to make packaging and building easier. I plan on writing a PR to https://github.com/vivien/i3blocks-contrib/ so it will be upstreamed on AUR.

joandrsn commented 4 years ago

Hmm thats a bit of a thinker.

A solution would be to make it like date(1) with format string, but I think that would be too overkill.

For now, a solution could simply be: -n {d}, where d is the number of decimals, settable from 0 to X (maybe max 5?)

falkecarlsen commented 4 years ago

Maybe just limiting to percentage formatting would be a workable compromise.

I've written the PR for i3blocks-contrib where a formatting string for the percentage is available as an argument: https://github.com/vivien/i3blocks-contrib/pull/304