[Pkg-xfce-devel] xfce4-power-manager BUG + possible FIX

Bernd s1237382 at gmail.com
Sat Jul 23 00:17:33 UTC 2016


Dear maintainer(s),

first time I try to give some feedback, so please don't feel offended, or even beat me, if this is not the right place to report.


PACKAGE
=======
Package: xfce4-power-manager
Version: 1.4.4-4ubuntu2


PROBLEM DESCRIPTION
===================
Running xfce4-power-manager on a lubuntu 16.04 system using a laptop running on battery I kept receiving the following notification 'GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:Permission denied'

Investigating further it turned out, there was a discrepancy between 'xfce4-power-manger-settings' GUI reporting the sleep mode on battery to be "Suspend" and 'dbus-monitor --system' reporting the real action taking place to be an attempt to go into "Hibernate" mode (relevant part cited below), which in turn is disabled via polkit-1 on my system.

---
method call time=1469228622.268937 sender=:1.62 -> destination=org.freedesktop.login1 serial=25 path=/org/freedesktop/login1; interface=org.freedesktop.login1.Manager; member=Hibernate
   boolean true
---


STEPS TO REPRODUCE
==================
1. reset/remove xfce-power-manager.xml configuration
2. disable action "org.freedesktop.login1.hibernate" via polkit-1
3. unplug laptop from power source
4. keep doing nothing for 15 minutes


INVESTIGATION
=============
Digging the sources I found the problem to be split between src/xfpm-xfconf.c:489 setting the default value of the property "inactivity-sleep-mode-on-battery" to XFP_DO_HIBERNATE and 'xfpm_settings_on_battery()' in settings/xfpm-settings.c:863 narrowing down possible ComboBox options down to those actually supported by system policy.

Given an empty/default xfce4-power-manager.xml configuration and via system policy disabled hibernate this leads to the funny fact that 'xfce4-power-manager-settings' GUI will not only wrongly "report" the selected sleep mode to be "Suspend".
But even worse never never never ever allow the user to really switch sleep mode on battery to "Suspend", as to fire the necessary callback it would be necessary to actually change the ComboBox selection, which given a single choice is impossible.

I managed to circumvent the problem manually adding: <property name="inactivity-sleep-mode-on-battery" type="uint" value="1"/> to the configuration file, but probably this might not be the most obvious i.e. user friendly way to handle such situations.


SUGGESTED FIX
=============
To handle scenarios like the one described with either "Suspend", "Hibernate", or even both unavailable imho it wouldn't be too painful to allow XFPM_DO_NOTHING as another option for both properties "inactivity-sleep-mode-on-battery" and "inactivity-sleep-mode-on-ac". 

This would not only allow to select either "Suspend" or "Hibernate" even if the other one isn't available still firing the necessary callback in 'xfce4-power-manager-settings', but also allow to still show a meaningful value in the GUI in case both of them are unavailable.

I put a patch just doing this in the attachment. 


BTW
===
imho lowering the "magic" never timeout value from 14 to 0 and allowing a range starting from 0 wouldn't be to painful, especially for testing purposes. :) I know it is already possible to use lower values manually hacking the config file, but again probably this is not the most obvious and user-friendly way.


Best regards
  Bernd.


-- 
Bernd <s1237382 at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-settings.patch
Type: text/x-diff
Size: 2881 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-xfce-devel/attachments/20160723/abd5f330/attachment.patch>


More information about the Pkg-xfce-devel mailing list