mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
WindowServer: Add a shutdown option to the menu, rather than forcing terminal use
This commit is contained in:
parent
952382b413
commit
c52d553249
Notes:
sideshowbarker
2024-07-19 13:35:11 +09:00
Author: https://github.com/rburchell Commit: https://github.com/SerenityOS/serenity/commit/c52d553249b Pull-request: https://github.com/SerenityOS/serenity/pull/232 Reviewed-by: https://github.com/awesomekling
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user