Taskbar: Show Settings app instead of Settings app category

The Settings app is basically a viewer for the Settings app category
anyway, so let's just direct users there instead of having the various
settings apps in the start menu.
This commit is contained in:
Andreas Kling 2021-07-26 01:55:32 +02:00
parent 03040f1d10
commit 4e2c5cd19e
Notes: sideshowbarker 2024-07-18 08:20:08 +09:00

View File

@ -158,12 +158,17 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
app_category_menus.set(category, category_menu); app_category_menus.set(category, category_menu);
}; };
for (const auto& category : sorted_app_categories) for (const auto& category : sorted_app_categories) {
create_category_menu(category); if (category != "Settings"sv)
create_category_menu(category);
}
// Then we create and insert all the app menu items into the right place. // Then we create and insert all the app menu items into the right place.
int app_identifier = 0; int app_identifier = 0;
for (const auto& app : g_apps) { for (const auto& app : g_apps) {
if (app.category == "Settings"sv)
continue;
auto icon = GUI::FileIconProvider::icon_for_executable(app.executable).bitmap_for_size(16); auto icon = GUI::FileIconProvider::icon_for_executable(app.executable).bitmap_for_size(16);
if constexpr (SYSTEM_MENU_DEBUG) { if constexpr (SYSTEM_MENU_DEBUG) {
@ -231,6 +236,17 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
} }
} }
system_menu->add_action(GUI::Action::create("Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-settings.png"), [](auto&) {
pid_t child_pid;
const char* argv[] = { "/bin/Settings", nullptr };
if ((errno = posix_spawn(&child_pid, "/bin/Settings", nullptr, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn");
} else {
if (disown(child_pid) < 0)
perror("disown");
}
}));
system_menu->add_separator(); system_menu->add_separator();
system_menu->add_action(GUI::Action::create("Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"), [](auto&) { system_menu->add_action(GUI::Action::create("Help", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"), [](auto&) {
pid_t child_pid; pid_t child_pid;