From 8dc6e60c2d7afd62ba582e778939fcef3f54f1df Mon Sep 17 00:00:00 2001 From: FelipeFTN Date: Wed, 1 Mar 2023 01:48:16 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=91=20logout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/handler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/handler/handler.c b/handler/handler.c index a81f58f..9acb4ae 100644 --- a/handler/handler.c +++ b/handler/handler.c @@ -16,8 +16,8 @@ // Get command options char *get_commands() { - char *message = "===== MySecurity =====\n\n[1] Shutdown Computer\n[2] Reboot " - "Computer\n[0] Exit"; + char *message = "===== MySecurity =====\n[1] Shutdown Computer\n[2] Reboot " + "Computer\n[3] Log out\n[0] Exit"; char *message_ptr = message; return message_ptr; @@ -39,6 +39,10 @@ int run_command(char *option) { system("shutdown -r -t 0"); break; + case 3: + system("shutdown -L"); + break; + default: return -1; } @@ -56,6 +60,10 @@ int run_command(char *option) { system("sudo reboot"); break; + case 3: + system("gnome-session-save --force-logout"); // Gnome + break; + default: return -1; }