summaryrefslogtreecommitdiff
path: root/xfce4-session-logout
diff options
context:
space:
mode:
authorpoma <poma@gmail.com>2016-08-17 01:57:12 +0200
committerEric Koegel <eric.koegel@gmail.com>2017-06-11 10:44:15 +0300
commit37f681e6c203c0ad8837869ccef45d32a8489afd (patch)
tree5eacfc59f2ef583574d98a798133abfe242f7759 /xfce4-session-logout
parent39bfeda73e5d30b094278f8166fe644e023a8b47 (diff)
downloadxfce4-session-37f681e6c203c0ad8837869ccef45d32a8489afd.tar.gz
Hybrid Sleep support - "hibernate" and suspend the system
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 Signed-off-by: Eric Koegel <eric.koegel@gmail.com>
Diffstat (limited to 'xfce4-session-logout')
-rw-r--r--xfce4-session-logout/main.c17
-rw-r--r--xfce4-session-logout/xfce4-session-logout.13
2 files changed, 20 insertions, 0 deletions
diff --git a/xfce4-session-logout/main.c b/xfce4-session-logout/main.c
index e94d015b..8ced69a9 100644
--- a/xfce4-session-logout/main.c
+++ b/xfce4-session-logout/main.c
@@ -47,6 +47,7 @@ gboolean opt_halt = FALSE;
gboolean opt_reboot = FALSE;
gboolean opt_suspend = FALSE;
gboolean opt_hibernate = FALSE;
+gboolean opt_hybrid_sleep = FALSE;
gboolean opt_switch_user = FALSE;
gboolean opt_fast = FALSE;
gboolean opt_version = FALSE;
@@ -59,6 +60,7 @@ enum
XFSM_SHUTDOWN_REBOOT,
XFSM_SHUTDOWN_SUSPEND,
XFSM_SHUTDOWN_HIBERNATE,
+ XFSM_SHUTDOWN_HYBRID_SLEEP,
XFSM_SHUTDOWN_SWITCH_USER
};
@@ -84,6 +86,10 @@ static GOptionEntry option_entries[] =
N_("Hibernate without displaying the logout dialog"),
NULL
},
+ { "hybrid-sleep", 'h', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_hybrid_sleep,
+ N_("Hybrid Sleep without displaying the logout dialog"),
+ NULL
+ },
{ "switch-user", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_switch_user,
N_("Switch user without displaying the logout dialog"),
NULL
@@ -200,6 +206,15 @@ main (int argc, char **argv)
NULL,
&err);
}
+ else if (opt_hybrid_sleep)
+ {
+ result = g_dbus_proxy_call_sync (proxy, "HybridSleep",
+ g_variant_new("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &err);
+ }
else if (opt_switch_user)
{
result = g_dbus_proxy_call_sync (proxy, "SwitchUser",
@@ -240,6 +255,8 @@ main (int argc, char **argv)
shutdown_type = XFSM_SHUTDOWN_SUSPEND;
else if (opt_hibernate)
shutdown_type = XFSM_SHUTDOWN_HIBERNATE;
+ else if (opt_hybrid_sleep)
+ shutdown_type = XFSM_SHUTDOWN_HYBRID_SLEEP;
else if (opt_switch_user)
shutdown_type = XFSM_SHUTDOWN_SWITCH_USER;
else
diff --git a/xfce4-session-logout/xfce4-session-logout.1 b/xfce4-session-logout/xfce4-session-logout.1
index bbcc3656..30ce9711 100644
--- a/xfce4-session-logout/xfce4-session-logout.1
+++ b/xfce4-session-logout/xfce4-session-logout.1
@@ -34,6 +34,9 @@ Suspend without displaying the logout dialog.
.B \-\-hibernate
Hibernate without displaying the logout dialog.
.TP
+.B \-\-hybrid-sleep
+Hybrid Sleep without displaying the logout dialog.
+.TP
.B \-\-fast
Do a fast shutdown. This instructs the session manager
not to save the session, but instead to quit everything