-
Notifications
You must be signed in to change notification settings - Fork 88
wip centralised thresholds system #1274
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
base: master
Are you sure you want to change the base?
Conversation
ff887f1 to
96615f1
Compare
|
IMO those 3 options are probably too many. I would prefer the Instead of blindly taking the first rfind key that is slower than value, we might think about allowing multiple Its okay to have a breaking change with There are a few more things to consider:
Edit: Maybe some way to determine the value via code would be awesome, e.g. specifying a script file or allow wasm. but that might be overengineered for now |
|
In the case of the network-manager module, the default way of configuring it would be the manual method, using the thresholds that I copied from NetworkManager, replacing that strange function I made to map strength to level. I see value in the dynamic method, in cases where a huge list of icons might be passed and the user doesn't want to tweak all threshold values whenever they want to add or remove an item. But I'm not sure if this will happen often. It may also not map well to the signal strengths NetworkManager provides, but I'm not certain, that's why I copied them directly from NetworkManager. The basic method sounds too specialized to me, but I see the value in case you want to migrate some modules to the new system while maintaining compatibility. Maybe there should be a script variant if handling more complex cases ever becomes necessary? This would require adding support for passing arguments to scripts, though. |
|
Thanks for the feedback both. Sounds like at a minimum I'll do away with the basic mode. My own thoughts below.
My concern here is that you would always want the non-linear logic - I'd rather keep that integrated into the code and not in the config. The problem I see otherwise (and I guess this applies generally to the manual approach) is that if I wanted to change one of the icons for example, I now need to find which threshold value it currently uses and set that. If it's linear that is at least more predictable. Perhaps for network manager specifically we can do something similar to what you're doing and convert between the linear scale and NM's scale.
This sounds like it complicates things too much to me. The current "floor" approach feels like the most predictable/understandable approach to configure.
This sounds like a separate feature request, even if it does integrate with this. That can be achieved via external scripting already too.
Not sure what the ask is here, but again sounds like a separate request & needs fleshing out.
I think that may be too complex for now, but I'm open to adding it in the future. I'm just not seeing how it would work at a technical level (oneshot script triggered on event, some new dynamic string type thing?). With the long-term goal of adding a Lua API this should work nicely. I'm not too worried about low-level implementation details like the map type or performance concerns yet - I'm just prototyping currently. |
|
I am definitely fine with many things beeing part of a other feature request. I just want to encourage you to think at those when designing this API, so that we might be able to extend the config in the future and stay backwards compatible :) |
My concern is that I not sure if I know any better than the user what the mapping should be (although that sound like "evasion of responsibility"). For example, I just check gnome-shell, and there it uses another mapping (maybe my module should be based on this one, as it also uses GTK icons by default): https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/449a4e354af82a2412cfb1ee2fe26451631aeae6/js/ui/status/network.js#L46-57
I had think of putting the current default in the example configuration in the docs, so when changing the icons the user would only need to copy and paste from the example, and change them. But yes, changing the number of icons would be more annoying. |
Overview
This is a first draft at attempting to introduce a standardised system for configuring thresholds, ie for icon boundaries.
The system would apply to the following modules:
backlight(configure brightness icon, implement a backlight module #962 #1235)network_manager(configure wifi strength icon, feat: rework networkmanager module #1233)volume(configure volume icon)The following locations would also expand to use this with future updates:
battery(configure battery icon, Improve upower (battery) icon handling #935)music(configure volume icon)There may also be places I've missed.
Syntaxes
This introduces three separate syntax for configuring the thresholds in an attempt to appease everybody:
Basic
Offers pre-defined low/medium/high keywords that abstract the thresholds. The thresholds are always divided into equal thirds from
0-maxManual
Uses a map to define N number of thresholds, manually specifying the lower bound for each threshold. This allows for more explicit configuration, and non-linear thresholds.
A zero threshold must be defined.
API
The struct would be placed inside the config:
Currently a single
threshold_formethod is provided:Outstanding
manualformat assumes integers are used asHashMapkeys. This may not be supported by all formats.Questions:
batterymodule existing thresholds option. What to do there?I am looking for feedback on this! This is a bit of a "throw everything at the wall and see what sticks" approach. Anything regarding anything I've thought of above, or anything else you see.
Paging @xMAC94x @Rodrigodd as both of you have open PRs pending a decision around this - feedback from the both of you on whether you think this would work for your modules would be especially valuable.