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 | |
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')
-rw-r--r-- | Userland/Applications/BrowserSettings/main.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/ClockSettings/main.cpp | 8 | ||||
-rw-r--r-- | Userland/Applications/DisplaySettings/main.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/KeyboardSettings/main.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/MailSettings/main.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/MouseSettings/main.cpp | 7 | ||||
-rw-r--r-- | Userland/Applications/TerminalSettings/main.cpp | 7 |
7 files changed, 50 insertions, 0 deletions
diff --git a/Userland/Applications/BrowserSettings/main.cpp b/Userland/Applications/BrowserSettings/main.cpp index ff9a9304bc..4c4527b5f5 100644 --- a/Userland/Applications/BrowserSettings/main.cpp +++ b/Userland/Applications/BrowserSettings/main.cpp @@ -7,6 +7,7 @@ #include "BrowserSettingsWidget.h" #include "ContentFilterSettingsWidget.h" #include <LibConfig/Client.h> +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> @@ -19,6 +20,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("Browser"); + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, one of 'browser' or 'content-filtering'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/home", "r")); TRY(Core::System::unveil("/home/anon/.config/BrowserContentFilters.txt", "rwc")); @@ -30,6 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); (void)TRY(window->add_tab<BrowserSettingsWidget>("Browser", "browser")); (void)TRY(window->add_tab<ContentFilterSettingsWidget>("Content Filtering", "content-filtering")); + window->set_active_tab(selected_tab); window->show(); return app->exec(); diff --git a/Userland/Applications/ClockSettings/main.cpp b/Userland/Applications/ClockSettings/main.cpp index eaa0b26287..8b3918ab1b 100644 --- a/Userland/Applications/ClockSettings/main.cpp +++ b/Userland/Applications/ClockSettings/main.cpp @@ -7,6 +7,7 @@ #include "ClockSettingsWidget.h" #include "TimeZoneSettingsWidget.h" #include <LibConfig/Client.h> +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> @@ -20,6 +21,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("Taskbar"); + + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, one of 'clock' or 'time-zone'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + TRY(Core::System::pledge("stdio rpath recvfd sendfd proc exec")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/bin/timezone", "x")); @@ -33,6 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) (void)TRY(window->add_tab<TimeZoneSettingsWidget>("Time Zone", "time-zone")); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(540, 570); + window->set_active_tab(selected_tab); window->show(); return app->exec(); diff --git a/Userland/Applications/DisplaySettings/main.cpp b/Userland/Applications/DisplaySettings/main.cpp index b4bfcc0f7e..a247e6a9e7 100644 --- a/Userland/Applications/DisplaySettings/main.cpp +++ b/Userland/Applications/DisplaySettings/main.cpp @@ -12,6 +12,7 @@ #include "MonitorSettingsWidget.h" #include "ThemesSettingsWidget.h" #include <LibConfig/Client.h> +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> @@ -25,6 +26,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("WindowManager"); + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, one of 'background', 'fonts', 'monitor', 'themes', or 'workspaces'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + auto app_icon = GUI::Icon::default_icon("app-display-settings"); bool background_settings_changed = false; @@ -35,6 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) (void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts", "fonts")); (void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor", "monitor")); (void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces", "workspaces")); + window->set_active_tab(selected_tab); window->set_icon(app_icon.bitmap_for_size(16)); diff --git a/Userland/Applications/KeyboardSettings/main.cpp b/Userland/Applications/KeyboardSettings/main.cpp index acc4f2076c..2315ba15f3 100644 --- a/Userland/Applications/KeyboardSettings/main.cpp +++ b/Userland/Applications/KeyboardSettings/main.cpp @@ -6,6 +6,7 @@ */ #include "KeyboardSettingsWidget.h" +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/SettingsWindow.h> @@ -20,6 +21,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("KeyboardSettings"); + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, only option is 'keyboard'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + TRY(Core::System::pledge("stdio rpath recvfd sendfd proc exec")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/bin/keymap", "x")); @@ -32,6 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto window = TRY(GUI::SettingsWindow::create("Keyboard Settings")); window->set_icon(app_icon.bitmap_for_size(16)); auto keyboard_settings_widget = TRY(window->add_tab<KeyboardSettingsWidget>("Keyboard", "keyboard")); + window->set_active_tab(selected_tab); window->on_active_window_change = [&](bool is_active_window) { keyboard_settings_widget->window_activated(is_active_window); diff --git a/Userland/Applications/MailSettings/main.cpp b/Userland/Applications/MailSettings/main.cpp index 3716c6abb0..76ad08d773 100644 --- a/Userland/Applications/MailSettings/main.cpp +++ b/Userland/Applications/MailSettings/main.cpp @@ -7,6 +7,7 @@ #include "MailSettingsWidget.h" #include <LibConfig/Client.h> +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> @@ -21,6 +22,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domain("Mail"); + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, only option is 'mail'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); @@ -30,6 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto window = TRY(GUI::SettingsWindow::create("Mail Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes)); (void)TRY(window->add_tab<MailSettingsWidget>("Mail", "mail")); window->set_icon(app_icon.bitmap_for_size(16)); + window->set_active_tab(selected_tab); window->show(); return app->exec(); 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(); diff --git a/Userland/Applications/TerminalSettings/main.cpp b/Userland/Applications/TerminalSettings/main.cpp index 655aeee61e..bfa191df20 100644 --- a/Userland/Applications/TerminalSettings/main.cpp +++ b/Userland/Applications/TerminalSettings/main.cpp @@ -5,6 +5,7 @@ */ #include "TerminalSettingsWidget.h" +#include <LibCore/ArgsParser.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/ConnectionToWindowServer.h> @@ -20,6 +21,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("Terminal"); + StringView selected_tab; + Core::ArgsParser args_parser; + args_parser.add_option(selected_tab, "Tab, one of 'terminal' or 'view'", "open-tab", 't', "tab"); + args_parser.parse(arguments); + TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); @@ -30,6 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); (void)TRY(window->add_tab<TerminalSettingsMainWidget>("Terminal", "terminal")); (void)TRY(window->add_tab<TerminalSettingsViewWidget>("View", "view")); + window->set_active_tab(selected_tab); window->show(); return app->exec(); |