diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-04-21 15:34:53 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-21 17:24:42 +0200 |
commit | 5702f016f008109c8807ed0be4d93e1fa12be938 (patch) | |
tree | 57a7b539ea7a1b71c3b646f55ddcae3ba0c4218d /Userland/Applications/MouseSettings | |
parent | ded5ba1f8764e95e2c2b51e3e09200059a26c6c6 (diff) | |
download | serenity-5702f016f008109c8807ed0be4d93e1fa12be938.zip |
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.
Diffstat (limited to 'Userland/Applications/MouseSettings')
-rw-r--r-- | Userland/Applications/MouseSettings/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Applications/MouseSettings/main.cpp b/Userland/Applications/MouseSettings/main.cpp index 18fbc2dc2c..ca004fb9e9 100644 --- a/Userland/Applications/MouseSettings/main.cpp +++ b/Userland/Applications/MouseSettings/main.cpp @@ -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(); |