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 <[email protected]>
Index: xfce4-power-manager-1.4.4/settings/xfpm-settings.c
===================================================================
--- xfce4-power-manager-1.4.4.orig/settings/xfpm-settings.c
+++ xfce4-power-manager-1.4.4/settings/xfpm-settings.c
@@ -885,6 +885,9 @@ xfpm_settings_on_battery (XfconfChannel
inact_action = GTK_WIDGET (gtk_builder_get_object (xml, "system-sleep-mode-on-battery"));
gtk_combo_box_set_model (GTK_COMBO_BOX(inact_action), GTK_TREE_MODEL(list_store));
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, _("Do nothing"), 1, XFPM_DO_NOTHING, -1);
+
if ( can_suspend )
{
gtk_list_store_append (list_store, &iter);
@@ -1111,6 +1114,9 @@ xfpm_settings_on_ac (XfconfChannel *chan
inact_action = GTK_WIDGET (gtk_builder_get_object (xml, "system-sleep-mode-on-ac"));
gtk_combo_box_set_model (GTK_COMBO_BOX(inact_action), GTK_TREE_MODEL(list_store));
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, _("Do nothing"), 1, XFPM_DO_NOTHING, -1);
+
if ( can_suspend )
{
gtk_list_store_append (list_store, &iter);
Index: xfce4-power-manager-1.4.4/src/xfpm-xfconf.c
===================================================================
--- xfce4-power-manager-1.4.4.orig/src/xfpm-xfconf.c
+++ xfce4-power-manager-1.4.4/src/xfpm-xfconf.c
@@ -490,9 +490,9 @@ xfpm_xfconf_class_init (XfpmXfconfClass
PROP_IDLE_SLEEP_MODE_ON_BATTERY,
g_param_spec_uint (INACTIVITY_SLEEP_MODE_ON_BATTERY,
NULL, NULL,
- XFPM_DO_SUSPEND,
- XFPM_DO_HIBERNATE,
+ XFPM_DO_NOTHING,
XFPM_DO_HIBERNATE,
+ XFPM_DO_NOTHING,
G_PARAM_READWRITE));
/**
@@ -502,9 +502,9 @@ xfpm_xfconf_class_init (XfpmXfconfClass
PROP_IDLE_SLEEP_MODE_ON_AC,
g_param_spec_uint (INACTIVITY_SLEEP_MODE_ON_AC,
NULL, NULL,
- XFPM_DO_SUSPEND,
+ XFPM_DO_NOTHING,
XFPM_DO_HIBERNATE,
- XFPM_DO_SUSPEND,
+ XFPM_DO_NOTHING,
G_PARAM_READWRITE));
/**
_______________________________________________
Pkg-xfce-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-xfce-devel