[Xfce4-commits] [xfce/xfce4-panel] 01/01: actions: Show Hybrid Sleep option (Bug #12771)
noreply at xfce.org
noreply at xfce.org
Wed Nov 15 17:36:47 CET 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit 5ab8e2ba2ddac3e13a44a94e11318e45070e23e8
Author: poma <pomidorabelisima at gmail.com>
Date: Wed Nov 15 17:35:23 2017 +0100
actions: Show Hybrid Sleep option (Bug #12771)
i.e. "hibernate" and suspend the system.
Hybrid Sleep support, here in the Xfce's panel - via Action Buttons,
is dependent on Hybrid Sleep support in the Xfce's session manager:
https://git.xfce.org/xfce/xfce4-session/commit/?id=37f681e6c203c0ad8837869ccef45d32a8489afd
Hybrid Sleep initially only writes hibernation image to SWAP space,
it does not power off the machine, as a whole Suspend To Disk (S4) does,
it rather Suspend To RAM (S3).
The benefit of this combination is pronto RESUME from S3,
whilst in case of battery drained or interruptions in power supply of any kind,
you ain't gonna lose your work.
Hybrid Sleep is the feature of the Linux kernel.
To test it directly via cli:
echo suspend > /sys/power/disk ; echo disk > /sys/power/state
However to make this feature work,
both Suspend To RAM (S3) and Suspend To Disk (S4)
must be provided by the hardware
dmesg:
ACPI: (supports ... S3 S4 ...)
in working order.
Furthermore Suspend To Disk (S4) requires a relatively simple configuration
an appendix to kernel command line:
resume=<path to resume partition>
i.e. directive to utilize particular SWAP space
man 7 dracut.cmdline
Ref.
https://www.kernel.org/doc/Documentation/power/swsusp.txt
---
migrate/migrate-config.c | 3 +++
plugins/actions/actions.c | 27 +++++++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/migrate/migrate-config.c b/migrate/migrate-config.c
index d0d49e7..5d92d26 100644
--- a/migrate/migrate-config.c
+++ b/migrate/migrate-config.c
@@ -99,6 +99,9 @@ migrate_config_action_48_convert (gint action)
case 7: /* ACTION_HIBERNATE */
return "+hibernate";
+ case 8: /* ACTION_HYBRID_SLEEP */
+ return "+hybrid-sleep";
+
default: /* ACTION_DISABLED */
return "-switch-user"; /* something else */
}
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 8e25353..bfa88b0 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -113,9 +113,10 @@ typedef enum
ACTION_TYPE_SWITCH_USER = 1 << 4,
ACTION_TYPE_LOCK_SCREEN = 1 << 5,
ACTION_TYPE_HIBERNATE = 1 << 6,
- ACTION_TYPE_SUSPEND = 1 << 7,
- ACTION_TYPE_RESTART = 1 << 8,
- ACTION_TYPE_SHUTDOWN = 1 << 9
+ ACTION_TYPE_HYBRID_SLEEP = 1 << 7,
+ ACTION_TYPE_SUSPEND = 1 << 8,
+ ACTION_TYPE_RESTART = 1 << 9,
+ ACTION_TYPE_SHUTDOWN = 1 << 10
}
ActionType;
@@ -183,6 +184,14 @@ static ActionEntry action_entries[] =
N_("Hibernating computer in %d seconds."),
"system-hibernate"
},
+ { ACTION_TYPE_HYBRID_SLEEP,
+ "hybrid-sleep",
+ N_("Hybrid Sleep"),
+ N_("_Hybrid Sleep"),
+ N_("Do you want to hibernate and suspend the system?"),
+ N_("Hibernating and Suspending computer in %d seconds."),
+ "system-hibernate"
+ },
{ ACTION_TYPE_SUSPEND,
"suspend",
N_("Suspend"),
@@ -806,7 +815,8 @@ actions_plugin_action_dbus_xfsm (const gchar *method,
error);
}
else if (g_strcmp0 (method, "Suspend") == 0
- || g_strcmp0 (method, "Hibernate") == 0)
+ || g_strcmp0 (method, "Hibernate") == 0
+ || g_strcmp0 (method, "HybridSleep") == 0)
{
retval = g_dbus_proxy_call_sync (proxy, method,
NULL,
@@ -914,6 +924,9 @@ actions_plugin_actions_allowed (void)
if (actions_plugin_action_dbus_can (proxy, "CanHibernate"))
PANEL_SET_FLAG (allow_mask, ACTION_TYPE_HIBERNATE);
+ if (actions_plugin_action_dbus_can (proxy, "CanHybridSleep"))
+ PANEL_SET_FLAG (allow_mask, ACTION_TYPE_HYBRID_SLEEP);
+
g_object_unref (G_OBJECT (proxy));
}
}
@@ -980,6 +993,11 @@ actions_plugin_action_activate (GtkWidget *widget,
FALSE, &error);
break;
+ case ACTION_TYPE_HYBRID_SLEEP:
+ succeed = actions_plugin_action_dbus_xfsm ("HybridSleep", FALSE,
+ FALSE, &error);
+ break;
+
case ACTION_TYPE_SUSPEND:
succeed = actions_plugin_action_dbus_xfsm ("Suspend", FALSE,
FALSE, &error);
@@ -1229,6 +1247,7 @@ actions_plugin_default_array (void)
"+separator",
"+suspend",
"-hibernate",
+ "-hybrid-sleep",
"-separator",
"+shutdown",
"-restart",
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list