diff options
author | Filiph Sandström <filiph.sandstrom@filfatstudios.com> | 2022-07-12 18:45:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-13 00:51:48 +0200 |
commit | a1ddc44c079086704c42a37e11b632edb9645a74 (patch) | |
tree | 8d35eb461c31c6c4c46fefe4a7c038fdf86647fd /Userland/Applets | |
parent | 3ee5bdcfb7828755f052a3b018f8471fcf03c93b (diff) | |
download | serenity-a1ddc44c079086704c42a37e11b632edb9645a74.zip |
WorkspacePicker: Hide applet if size == 0
Diffstat (limited to 'Userland/Applets')
-rw-r--r-- | Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp | 6 | ||||
-rw-r--r-- | Userland/Applets/WorkspacePicker/main.cpp | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp index 5577169b1f..dddf6ff7bf 100644 --- a/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp +++ b/Userland/Applets/WorkspacePicker/DesktopStatusWindow.cpp @@ -104,6 +104,12 @@ private: DesktopStatusWindow::DesktopStatusWindow() { GUI::Desktop::the().on_receive_screen_rects([&](GUI::Desktop&) { + auto& desktop = GUI::Desktop::the(); + if (desktop.workspace_rows() == 1 && desktop.workspace_columns() == 1) + resize(0, 0); + else + resize(28, 16); + update(); }); set_window_type(GUI::WindowType::Applet); diff --git a/Userland/Applets/WorkspacePicker/main.cpp b/Userland/Applets/WorkspacePicker/main.cpp index 74454600c3..abdb378182 100644 --- a/Userland/Applets/WorkspacePicker/main.cpp +++ b/Userland/Applets/WorkspacePicker/main.cpp @@ -8,6 +8,7 @@ #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/ConnectionToWindowManagerServer.h> +#include <LibGUI/Desktop.h> #include <LibGUI/Painter.h> #include <LibMain/Main.h> #include <WindowServer/Window.h> @@ -25,7 +26,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto window = TRY(DesktopStatusWindow::try_create()); window->set_title("WorkspacePicker"); - window->resize(28, 16); + + auto& desktop = GUI::Desktop::the(); + if (desktop.workspace_rows() == 1 && desktop.workspace_columns() == 1) + window->resize(0, 0); + else + window->resize(28, 16); + window->show(); window->make_window_manager(WindowServer::WMEventMask::WorkspaceChanges); |