summaryrefslogtreecommitdiff
path: root/Servers/WindowServer
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-06-16 11:53:10 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-16 12:25:30 +0200
commitc52d553249b6182e8eb76ccbb7bede3db4b5fa22 (patch)
treebd77af7544d90b07b2e539f00a22b76edeb94a54 /Servers/WindowServer
parent952382b413484f3d81e7387e8ec0916bd5f48dc1 (diff)
downloadserenity-c52d553249b6182e8eb76ccbb7bede3db4b5fa22.zip
WindowServer: Add a shutdown option to the menu, rather than forcing terminal use
Diffstat (limited to 'Servers/WindowServer')
-rw-r--r--Servers/WindowServer/WSWindowManager.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp
index aba405aeab..a796617b44 100644
--- a/Servers/WindowServer/WSWindowManager.cpp
+++ b/Servers/WindowServer/WSWindowManager.cpp
@@ -65,6 +65,8 @@ WSWindowManager::WSWindowManager()
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 100, "Reload WM Config File"));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 200, "About..."));
+ m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
+ m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 300, "Shutdown..."));
m_system_menu->on_item_activation = [this, apps](WSMenuItem& item) {
if (item.identifier() >= 1 && item.identifier() <= 1 + apps.size() - 1) {
if (fork() == 0) {
@@ -77,13 +79,18 @@ WSWindowManager::WSWindowManager()
case 100:
reload_config(true);
break;
- }
- if (item.identifier() == 200) {
+ case 200:
if (fork() == 0) {
execl("/bin/About", "/bin/About", nullptr);
ASSERT_NOT_REACHED();
}
return;
+ case 300:
+ if (fork() == 0) {
+ execl("/bin/shutdown", "/bin/shutdown", "-n", nullptr);
+ ASSERT_NOT_REACHED();
+ }
+ return;
}
#ifdef DEBUG_MENUS
dbgprintf("WSMenu 1 item activated: '%s'\n", item.text().characters());