Skip to content

Commit

Permalink
πŸ‘‘ logout
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeFTN committed Mar 1, 2023
1 parent d8d6f21 commit 8dc6e60
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions handler/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,6 +39,10 @@ int run_command(char *option) {
system("shutdown -r -t 0");
break;

case 3:
system("shutdown -L");
break;

default:
return -1;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 8dc6e60

Please sign in to comment.