2020-01-18 11:38:21 +03:00
|
|
|
/*
|
2020-02-26 14:02:25 +03:00
|
|
|
* Copyright (c) 2019-2020, Jesse Buhagiar <jooster669@gmail.com>
|
2021-05-18 23:21:56 +03:00
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2022-04-21 17:12:09 +03:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2021-05-19 22:19:09 +03:00
|
|
|
#include "BackgroundSettingsWidget.h"
|
2021-06-30 20:28:16 +03:00
|
|
|
#include "DesktopSettingsWidget.h"
|
2022-08-08 03:02:34 +03:00
|
|
|
#include "EffectsSettingsWidget.h"
|
2021-05-21 19:55:30 +03:00
|
|
|
#include "FontSettingsWidget.h"
|
2021-05-19 22:43:54 +03:00
|
|
|
#include "MonitorSettingsWidget.h"
|
2022-03-27 22:32:32 +03:00
|
|
|
#include "ThemesSettingsWidget.h"
|
2021-08-29 17:05:41 +03:00
|
|
|
#include <LibConfig/Client.h>
|
2022-04-21 17:34:53 +03:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2021-11-27 14:49:54 +03:00
|
|
|
#include <LibCore/System.h>
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/Application.h>
|
2020-11-02 22:30:17 +03:00
|
|
|
#include <LibGUI/Icon.h>
|
2021-11-20 18:28:46 +03:00
|
|
|
#include <LibGUI/SettingsWindow.h>
|
2021-11-27 14:49:54 +03:00
|
|
|
#include <LibMain/Main.h>
|
2019-09-03 14:45:02 +03:00
|
|
|
|
2021-11-27 14:49:54 +03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
2019-09-03 14:45:02 +03:00
|
|
|
{
|
2022-05-10 02:35:13 +03:00
|
|
|
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
2020-01-13 14:22:49 +03:00
|
|
|
|
2021-11-27 14:49:54 +03:00
|
|
|
auto app = TRY(GUI::Application::try_create(arguments));
|
2022-02-11 19:33:09 +03:00
|
|
|
Config::pledge_domain("WindowManager");
|
2020-01-13 14:22:49 +03:00
|
|
|
|
2022-04-21 17:34:53 +03:00
|
|
|
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);
|
|
|
|
|
2022-07-11 20:32:29 +03:00
|
|
|
auto app_icon = GUI::Icon::default_icon("app-display-settings"sv);
|
2020-11-02 22:30:17 +03:00
|
|
|
|
2022-04-03 12:51:54 +03:00
|
|
|
bool background_settings_changed = false;
|
|
|
|
|
2021-11-28 10:34:04 +03:00
|
|
|
auto window = TRY(GUI::SettingsWindow::create("Display Settings"));
|
2023-03-10 21:04:13 +03:00
|
|
|
(void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>(TRY("Background"_string), "background"sv, background_settings_changed));
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes"_short_string, "themes"sv, background_settings_changed));
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"_short_string, "fonts"sv));
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"_short_string, "monitor"sv));
|
|
|
|
(void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>(TRY("Workspaces"_string), "workspaces"sv));
|
|
|
|
(void)TRY(window->add_tab<GUI::DisplaySettings::EffectsSettingsWidget>("Effects"_short_string, "effects"sv));
|
2022-04-21 17:34:53 +03:00
|
|
|
window->set_active_tab(selected_tab);
|
2019-12-28 16:59:56 +03:00
|
|
|
|
2021-05-18 23:21:56 +03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2019-12-28 16:59:56 +03:00
|
|
|
|
2019-09-03 14:45:02 +03:00
|
|
|
window->show();
|
2020-07-04 15:05:19 +03:00
|
|
|
return app->exec();
|
2019-09-03 14:45:02 +03:00
|
|
|
}
|