This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository e16.
View the commit online.
commit 91ef25bb42f5ba53f8444c648b9a89a05ec417f8
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Thu Oct 12 09:01:12 2023 +0200
session: Enable setting suspend and hibernate actions
If set the options are presented in the logout dialog.
Suggestion from Milan Maljković.
---
docs/e16.asc | 4 ++++
src/E.h | 2 ++
src/mod-misc.c | 2 ++
src/session.c | 22 ++++++++++++++++++++++
4 files changed, 30 insertions(+)
diff --git a/docs/e16.asc b/docs/e16.asc
index ba1f3f00..fce5d98f 100644
--- a/docs/e16.asc
+++ b/docs/e16.asc
@@ -1083,6 +1083,10 @@ misc.session.enable_reboot_halt = 0
misc.session.cmd_reboot = reboot
# [string] Halt command
misc.session.cmd_halt = poweroff
+# [string] Suspend command (if set, option is shown in logout dialog)
+misc.session.cmd_suspend =
+# [string] Hibernate command (if set, option is shown in logout dialog)
+misc.session.cmd_hibernate =
# [bool] Enable animation of window shading
misc.shading.animate = 1
diff --git a/src/E.h b/src/E.h
index e47ce7c9..6e0b7435 100644
--- a/src/E.h
+++ b/src/E.h
@@ -265,6 +265,8 @@ typedef struct {
char enable_reboot_halt;
char *cmd_reboot;
char *cmd_halt;
+ char *cmd_suspend;
+ char *cmd_hibernate;
} session;
struct {
char animate;
diff --git a/src/mod-misc.c b/src/mod-misc.c
index ab4c3c0e..fcb29efa 100644
--- a/src/mod-misc.c
+++ b/src/mod-misc.c
@@ -196,6 +196,8 @@ static const CfgItem MiscCfgItems[] = {
CFG_ITEM_BOOL(Conf, session.enable_reboot_halt, 0),
CFG_ITEM_STR(Conf, session.cmd_reboot),
CFG_ITEM_STR(Conf, session.cmd_halt),
+ CFG_ITEM_STR(Conf, session.cmd_suspend),
+ CFG_ITEM_STR(Conf, session.cmd_hibernate),
CFG_ITEM_BOOL(Conf, shading.animate, 1),
CFG_ITEM_INT(Conf, shading.speed, 8000),
diff --git a/src/session.c b/src/session.c
index 9e31c9d4..8a398ed8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -561,6 +561,8 @@ SessionLogout(void)
#define LOGOUT_EXIT 1
#define LOGOUT_REBOOT 2
#define LOGOUT_HALT 3
+#define LOGOUT_SUSPEND 4
+#define LOGOUT_HIBERNATE 5
static void
LogoutCB(Dialog * d, int val, void *data __UNUSED__)
@@ -588,12 +590,20 @@ LogoutCB(Dialog * d, int val, void *data __UNUSED__)
case LOGOUT_HALT:
SessionExit(EEXIT_EXEC, Conf.session.cmd_halt);
break;
+ case LOGOUT_SUSPEND:
+ SessionExit(EEXIT_EXEC, Conf.session.cmd_suspend);
+ break;
+ case LOGOUT_HIBERNATE:
+ SessionExit(EEXIT_EXEC, Conf.session.cmd_hibernate);
+ break;
}
}
DialogClose(d);
}
+#define ISSET(s) (s && *s != '\0')
+
static void
SessionLogoutConfirm(void)
{
@@ -615,6 +625,18 @@ SessionLogoutConfirm(void)
DialogItemSetAlign(table, 512, 0);
DialogItemSetFill(table, 0, 0);
tcols = 0;
+ if (ISSET(Conf.session.cmd_hibernate))
+ {
+ tcols += 1;
+ DialogItemAddButton(table, _("Yes, Hibernate"), LogoutCB,
+ LOGOUT_HIBERNATE, 1, DLG_BUTTON_OK);
+ }
+ if (ISSET(Conf.session.cmd_suspend))
+ {
+ tcols += 1;
+ DialogItemAddButton(table, _("Yes, Suspend"), LogoutCB,
+ LOGOUT_SUSPEND, 1, DLG_BUTTON_OK);
+ }
if (Conf.session.enable_reboot_halt)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.