linuxmint / cinnamon-settings-daemon

The settings daemon for the Cinnamon desktop
GNU General Public License v2.0
57 stars 58 forks source link

power: Add settings to disable low battery warnings for connected devices #379

Closed Lanchon closed 1 year ago

Lanchon commented 1 year ago

hi,

this is a long requested feature for gnome shell and cinnamon. there are too many posts asking how to disable low battery notifications, and someone even made some scripts that patch and recompile upower for gnome (works for gnome only; cinnamon is too different in this regard).

the problem is that many devices report low battery when they will be able to work fine for a long time, spamming the user with notifications. this happens a lot when users replace alkaline (1.5V nominal) batteries with nickel-based batteries (1.2V nominal). the lower voltage of the rechargeable batteries trigger the warning, but the devices typically work fine with just 1V or less.

this is a quick fix for keyboards and mice, which represent 99+ % of the issue i guess, with a coarse fix for the outliers if any. a different implementation could filter individual devices based on their upower device ID, instead of classes of devices. but i'm not familiar with the dconf system and wouldn't know the best way to implement such "variable schema" on it. (a set of ID strings? who knows.)

something is better than nothing and this implementation is here now, and the problem has been unfixed for ages so i'm obviously pushing to get this in. as i said, this should take care of most users.

the UI will be pushed in a companion PR.

thanks!

Lanchon commented 1 year ago

if you merge this here, then i'll try pushing the same change to gnome-settings-daemon (without UI changes).

or should i first try to get it into gnome?

Lanchon commented 1 year ago

for gnome: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/326

it is implemented differently on gnome. there upower handles the warning state changes, so i can't filter the warning signal before edge detection as i do in cinnamon. result is that on cinnamon, if you reenable a warning when its condition is met, a warning will soon be generated. while on gnome, when the event happens it is either shown or not; enabling the warning later will not trigger a warning.

Lanchon commented 1 year ago

hi @mtwebster, should i notify a reviewer or just wait? thanks!

mtwebster commented 1 year ago

Hi, I'm ok with this, but are three individual settings seems unnecessary. Both mouse and keyboard have typically long battery life in my experience (compared to something like a gamepad), and are treated similarly by upower already (reporting general battery status, not percentage) - maybe just have two settings, one for mouse/keyboard, and one for everything else?

Lanchon commented 1 year ago

@mtwebster hey thanks!

upower warn level is buggy and a mess. please note that csd-power ignores it and triggers its own warnings based on battery state, AFAICT.

maybe just have two settings, one for mouse/keyboard, and one for everything else?

this is the way i first implemented it, but then i backtracked and added the 3rd setting. i can absolutely go back to 2 settings, but first please allow me to tell you why i preferred 3:

so because of UI clarity and better usability, i went with 3 settings. given that kbd and mice are by far the most important and common input devices, special treatment for them did not seem unwarranted.

that said, please keep in mind that each setting only shows up only if you have an applicable device connected.

for example. this is my control panel: power

FYI, the UI works like this:

this is for UI clarity: if a toggle for "other" is needed (very unusual case, surely <1%) it will be clear and obvious what is not included in "other" (ie: keyboard and mouse) because these options will also be displayed. but 99% of users will only see the options they need for their setup. (full text of options here.)


that said, if you still think 2 settings are better than 3, then please confirm and i'll proceed with the changes.

and sorry for writing such a long message! :((

Lanchon commented 1 year ago

hi @clefebvre, maybe you got a minute for a review?

the related UI PR is https://github.com/linuxmint/cinnamon/pull/11599

thanks so much!

Lanchon commented 1 year ago

profound sadness... (╥﹏╥)

Lanchon commented 1 year ago

@mtwebster thank you!!!