diff --git a/Applications/SystemMenu/main.cpp b/Applications/SystemMenu/main.cpp index 90d3bc4a5cc..3ba29484661 100644 --- a/Applications/SystemMenu/main.cpp +++ b/Applications/SystemMenu/main.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -56,7 +57,6 @@ struct ThemeMetadata { Color g_menu_selection_color; -int g_theme_index { 0 }; Vector g_themes; RefPtr g_themes_menu; @@ -67,16 +67,9 @@ int main(int argc, char** argv) GUI::Application app(argc, argv); auto menu = build_system_menu(); + menu->realize_menu_if_needed(); - auto menubar = make(); - menubar->add_menu(move(menu)); - - app.set_menubar(move(menubar)); - - // FIXME: This window is just so we can see that the menu works. - // Once we have a way to make this the default system menu we can drop this. - auto window = GUI::Window::construct(); - window->show(); + GUI::WindowServerConnection::the().send_sync(menu->menu_id()); return app.exec(); } @@ -163,7 +156,8 @@ NonnullRefPtr build_system_menu() g_themes_menu->add_action(GUI::Action::create(theme.name, [theme_identifier](auto&) { auto& theme = g_themes[theme_identifier]; dbg() << "Theme switched to " << theme.name << " at path " << theme.path; - // FIXME: Tell WindowServer to switch theme! + auto response = GUI::WindowServerConnection::the().send_sync(theme.path, theme.name); + ASSERT(response->success()); })); ++theme_identifier; } diff --git a/Base/etc/SystemServer.ini b/Base/etc/SystemServer.ini index 96f9349cee5..e07c1804cd7 100644 --- a/Base/etc/SystemServer.ini +++ b/Base/etc/SystemServer.ini @@ -35,6 +35,10 @@ Priority=high KeepAlive=1 User=window +[SystemMenu] +KeepAlive=1 +User=anon + [Clock.MenuApplet] KeepAlive=1 User=anon