From 18b4748435dd8716b6a9fce560fe7502abd32a1a Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 11 Sep 2017 19:52:04 +0200 Subject: [PATCH] linux: allow Suspend as CriticalPowerAction When using UPower in a non-hybernate setup, the result of a CriticalPowerAction would be PowerOff. Certain users prefer Suspend instead, because this is the only way to recover graceful from that state. Suspend action will only used, when explicit configured. Closes: #23 Closes: #59 Signed-off-by: Kate Hsuan --- etc/UPower.conf | 2 ++ src/linux/up-backend.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/UPower.conf b/etc/UPower.conf index bae5d2e..b9968a9 100644 --- a/etc/UPower.conf +++ b/etc/UPower.conf @@ -88,7 +88,9 @@ TimeAction=120 # PowerOff # Hibernate # HybridSleep +# Suspend # +# If Suspend isn't available, HybridSleep will be used # If HybridSleep isn't available, Hibernate will be used # If Hibernate isn't available, PowerOff will be used CriticalPowerAction=HybridSleep diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index 2aac74d..1b55a65 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -553,11 +553,12 @@ up_backend_get_critical_action (UpBackend *backend) const gchar *method; const gchar *can_method; } actions[] = { + { "Suspend", "CanSuspend" }, { "HybridSleep", "CanHybridSleep" }, { "Hibernate", "CanHibernate" }, { "PowerOff", NULL }, }; - guint i = 0; + guint i = 1; char *action; g_return_val_if_fail (backend->priv->logind_proxy != NULL, NULL); @@ -569,7 +570,7 @@ up_backend_get_critical_action (UpBackend *backend) if (g_str_equal (actions[i].method, action)) break; if (i >= G_N_ELEMENTS (actions)) - i = 0; + i = 1; g_free (action); }