! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Add support for XF86Battery
Status:
RESOLVED: FIXED
Product:
Xfce4-power-manager
Component:
General

Comments

Description Viktor Odintsev editbugs 2017-12-04 12:26:26 CET
Created attachment 7467 
Add support for XF86Battery button

This button is already grabbed by xfpm but its events just getting ignored.

A long time ago this button caused battery notification to appear https://git.xfce.org/xfce/xfce4-power-manager/commit/src/xfpm-battery.c?id=2606edb1adedbe974034184d71575205a2b68fe4

Bringing this behavior back is much harder now since there may be multiple batteries installed but only single notification instance is used in xfpm. This behavior of notifications in XfpmBattery classes should be refactored in my opinion but that's another topic.

For now I'm suggesting to add a new picker in settings allowing to choose what to do when battery button pressed: nothing, suspend, hibernate or ask. Probably in the future we can add an additional "show status" action.
Comment 1 Simon Steinbeiss editbugs 2017-12-04 20:56:28 CET
There are some issues with the patch, e.g. here:

@@ -250,6 +251,7 @@ xfpm_settings_app_launch (GApplication *app)
     has_sleep_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "sleep-button"));
     has_power_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "power-button"));
     has_hibernate_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "hibernate-button"));
+    has_power_button = xfpm_string_to_bool (g_hash_table_lookup (hash, "power-button"));
     can_shutdown = xfpm_string_to_bool (g_hash_table_lookup (hash, "can-shutdown"));


Obviously the "has_power_button" variable should be renamed to "has_battery_button".
Comment 2 Viktor Odintsev editbugs 2017-12-04 21:04:28 CET
Created attachment 7470 
Add support for XF86Battery button

Yes, I accidentally removed the changes first time so I had to rewrite them again with less attention. This is not the only place where I messed up with replacements. I'm attaching a new patch.
Comment 3 Simon Steinbeiss editbugs 2017-12-05 16:50:53 CET
I noticed, I was just too lazy to point all of them out ;)

I'll review/test then. Thanks!

Regarding the show-status feature: Not really sure what to show there.
Comment 4 Viktor Odintsev editbugs 2017-12-05 17:47:55 CET
> Regarding the show-status feature: Not really sure what to show there.

Show notification with state of all batteries. Just like it was before in 2014 but with multiple batteries on single notification support.

As I told before in #xfce-dev, battery-specific notifications aren't informative. I'd suggest to remove notification support from XfpmBattery and move them all to XfpmPower. This new notification should show a state of all batteries in single popup window. For single-battery users everything remains the same, for multi-battery users it will be much informative. But that's the topic for another bug.
Comment 5 Git Bot editbugs 2017-12-19 00:57:20 CET
Viktor Odintsev referenced this bugreport in commit ebb984e33b6daf6ce320140ff4c31d533d6a3cee

Add support for XF86Battery button (Bug #14055)

https://git.xfce.org/xfce/xfce4-power-manager/commit?id=ebb984e33b6daf6ce320140ff4c31d533d6a3cee
Comment 6 Simon Steinbeiss editbugs 2017-12-19 00:57:59 CET
Decided to merge only after releasing 1.6.1 as introducing new strings would have further delayed the (long-awaited) release.
Thanks for the patch!

Bug #14055

Reported by:
Viktor Odintsev
Reported on: 2017-12-04
Last modified on: 2017-12-19

People

Assignee:
Ali Abdallah
CC List:
3 users

Version

Attachments

Add support for XF86Battery button (20.51 KB, patch)
2017-12-04 12:26 CET , Viktor Odintsev
no flags
Add support for XF86Battery button (20.51 KB, patch)
2017-12-04 21:04 CET , Viktor Odintsev
no flags

Additional information