xob icon indicating copy to clipboard operation
xob copied to clipboard

[Feature request] add an option to display the value

Open ArthurBais opened this issue 5 years ago • 6 comments

ArthurBais avatar Jul 23 '20 15:07 ArthurBais

Hello, Could you please detail your feature request a bit more? Do you mean displaying a textual representation of a value above or next to the bar?

florentc avatar Jul 23 '20 19:07 florentc

Hello, Could you please detail your feature request a bit more? Do you mean displaying a textual representation of a value above or next to the bar?

sorry, it didn't post the description for some reason...

Yeah, I meant that I'd like to see the value because right now it's just printing it out to the terminal.

ArthurBais avatar Jul 23 '20 19:07 ArthurBais

I see. Xlib has basic text rendering features, it might not overcomplicate the codebase. Although I am not particularly in favor of it, if there really is demand for such a feature then I will gladly merge a pull request that implements it and assist whoever wants to give it a go. Note there would be details to specify beforehand such as:

  • What would actually be displayed. Currently you choose a total number of subdivisions (by default 100) which is the granularity of the bar, and the values you feed to xob are how many of these units you want filled. In some advanced cases (e.g. high granularity or when an empty bar is not intended to mean 0) this raw value might not be what you would have liked to display. xob is about displaying a bar with no regards to the meaning the user intends to convey.
  • Where and how to display it. Above the bar? Next to it? Which size? How to manage size and position depending on the required length of text.
  • How it would all affect how you configure positions and sizes.

I think we should first gather additional user input on the matter.

florentc avatar Jul 24 '20 23:07 florentc

I'm working on it any suggestion on how the text should be placed? ex

AlecsFerra avatar Jul 17 '21 08:07 AlecsFerra

I'm working on it any suggestion on how the text should be placed? ![ex](https://camo.githubusercontent.com/118d8f27306372be7d62b7f477905b700578fefb2fe3db6b0d1e976d370a51cb/68747470733a2f2f692e696d6775722e636f6d2f474f723867676c2e706e67)

Can the position be configured? If not, I am okay with placing it on the right side.

MuhammedZakir avatar Jul 17 '21 12:07 MuhammedZakir

This is quite an undertaking! Managing the position, size, orientation, and color depending on how much of the bar is filled up, the troll cases when inputing a ridiculously high overflow value, etc.

I don't know if this may be useful to you but I plan to merge the tranparency pull request and have libxrender as an additional dependency. Maybe it has some convenient features for text rendering. Consider xrender as an available library to you. EDIT The feature has been merged and libxrender is now an optional dependency of xob.

Remember that any kind of value can be displayed in the bar. The input value is about how many subdivisions are to be filled up among a maximum (by default 100 but it could be 1000000). For example there could be a bar for screen color temperature with raw values from 0 to 3000 that represent actual screen temperatures from 3500K to 6500K. There is no actual way to know what the user actually displays.

Feel free to experiment and change things if you need to (e.g. displaying the text outside the bar on the left or right or in a dedicated cell if you want to avoid having to manage text visibility when the bar is almost full).

Thank you for your work on this.

florentc avatar Jul 18 '21 14:07 florentc