mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 13:15:06 +00:00
WindowServer: Add a shutdown option to the menu, rather than forcing terminal use
This commit is contained in:
parent
952382b413
commit
c52d553249
1 changed files with 9 additions and 2 deletions
|
@ -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, 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, WSMenuItem::Separator));
|
||||||
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, 200, "About..."));
|
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) {
|
m_system_menu->on_item_activation = [this, apps](WSMenuItem& item) {
|
||||||
if (item.identifier() >= 1 && item.identifier() <= 1 + apps.size() - 1) {
|
if (item.identifier() >= 1 && item.identifier() <= 1 + apps.size() - 1) {
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
|
@ -77,13 +79,18 @@ WSWindowManager::WSWindowManager()
|
||||||
case 100:
|
case 100:
|
||||||
reload_config(true);
|
reload_config(true);
|
||||||
break;
|
break;
|
||||||
}
|
case 200:
|
||||||
if (item.identifier() == 200) {
|
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
execl("/bin/About", "/bin/About", nullptr);
|
execl("/bin/About", "/bin/About", nullptr);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
case 300:
|
||||||
|
if (fork() == 0) {
|
||||||
|
execl("/bin/shutdown", "/bin/shutdown", "-n", nullptr);
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_MENUS
|
#ifdef DEBUG_MENUS
|
||||||
dbgprintf("WSMenu 1 item activated: '%s'\n", item.text().characters());
|
dbgprintf("WSMenu 1 item activated: '%s'\n", item.text().characters());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue