mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibGUI+Applications: Add --open-tab option to FooSettings applications
Similar to SystemMonitor's option of the same name, this allows you to launch the given application with the specific tab open.
This commit is contained in:
parent
ded5ba1f87
commit
5702f016f0
9 changed files with 67 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "MouseWidget.h"
|
||||
#include "ThemeWidget.h"
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
|
@ -23,12 +24,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd"));
|
||||
|
||||
StringView selected_tab;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(selected_tab, "Tab, one of 'cursor-theme' or 'mouse'", "open-tab", 't', "tab");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-mouse");
|
||||
|
||||
auto window = TRY(GUI::SettingsWindow::create("Mouse Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
|
||||
(void)TRY(window->add_tab<MouseWidget>("Mouse", "mouse"));
|
||||
(void)TRY(window->add_tab<ThemeWidget>("Cursor Theme", "cursor-theme"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->set_active_tab(selected_tab);
|
||||
|
||||
window->show();
|
||||
return app->exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue