[systemd-devel] [PATCH 2/6] logind: add lock action for button triggers

Ben Boeckel mathstuf at gmail.com
Sat Oct 27 00:08:52 PDT 2012


---
 man/logind.conf.xml       | 5 +++--
 src/login/logind-button.c | 9 ++++++---
 src/login/logind-button.h | 1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/man/logind.conf.xml b/man/logind.conf.xml
index 3d83d2c..10ea9e8 100644
--- a/man/logind.conf.xml
+++ b/man/logind.conf.xml
@@ -211,8 +211,9 @@
                                 <literal>poweroff</literal>,
                                 <literal>reboot</literal>,
                                 <literal>halt</literal>,
-                                <literal>kexec</literal> and
-                                <literal>hibernate</literal>. If
+                                <literal>kexec</literal>,
+                                <literal>hibernate</literal> and
+                                <literal>lock</literal>. If
                                 <literal>ignore</literal> logind will
                                 never handle these keys. Otherwise the
                                 specified action will be taken in the
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 8fdab78..d03eaea 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -163,7 +163,8 @@ static int button_handle(
                 [HANDLE_HALT] = "Halting...",
                 [HANDLE_KEXEC] = "Rebooting via kexec...",
                 [HANDLE_SUSPEND] = "Suspending...",
-                [HANDLE_HIBERNATE] = "Hibernating..."
+                [HANDLE_HIBERNATE] = "Hibernating...",
+                [HANDLE_LOCK] = "Locking..."
         };
 
         static const char * const target_table[_HANDLE_BUTTON_MAX] = {
@@ -172,7 +173,8 @@ static int button_handle(
                 [HANDLE_HALT] = "halt.target",
                 [HANDLE_KEXEC] = "kexec.target",
                 [HANDLE_SUSPEND] = "suspend.target",
-                [HANDLE_HIBERNATE] = "hibernate.target"
+                [HANDLE_HIBERNATE] = "hibernate.target",
+                [HANDLE_LOCK] = "lock.target"
         };
 
         DBusError error;
@@ -305,7 +307,8 @@ static const char* const handle_button_table[_HANDLE_BUTTON_MAX] = {
         [HANDLE_HALT] = "halt",
         [HANDLE_KEXEC] = "kexec",
         [HANDLE_SUSPEND] = "suspend",
-        [HANDLE_HIBERNATE] = "hibernate"
+        [HANDLE_HIBERNATE] = "hibernate",
+        [HANDLE_LOCK] = "lock"
 };
 DEFINE_STRING_TABLE_LOOKUP(handle_button, HandleButton);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_handle_button, handle_button, HandleButton, "Failed to parse handle button setting");
diff --git a/src/login/logind-button.h b/src/login/logind-button.h
index ca820ed..ecb2825 100644
--- a/src/login/logind-button.h
+++ b/src/login/logind-button.h
@@ -32,6 +32,7 @@ typedef enum HandleButton {
         HANDLE_KEXEC,
         HANDLE_SUSPEND,
         HANDLE_HIBERNATE,
+        HANDLE_LOCK,
         _HANDLE_BUTTON_MAX,
         _HANDLE_BUTTON_INVALID = -1
 } HandleButton;
-- 
1.7.12.1



More information about the systemd-devel mailing list