diff options
author | ForLoveOfCats <floc@unpromptedtirade.com> | 2021-06-28 21:00:12 -0400 |
---|---|---|
committer | Gunnar Beutner <gunnar@beutner.name> | 2021-07-04 13:58:56 +0200 |
commit | cefa2e3dd2455f40f7484a061ef02744149669a6 (patch) | |
tree | 372e8b51ad1f095858bb1c4a9abfb8229a7cd482 /Userland | |
parent | 271840ca222880b9e9b4897b66ce4a181abee047 (diff) | |
download | serenity-cefa2e3dd2455f40f7484a061ef02744149669a6.zip |
Taskbar: Add show desktop button to toggle showing of the desktop
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/Taskbar/TaskbarWindow.cpp | 11 | ||||
-rw-r--r-- | Userland/Services/Taskbar/TaskbarWindow.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index a69dd1ec31..59e7f29503 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -88,6 +88,12 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu) main_widget.add<Taskbar::ClockWidget>(); + m_show_desktop_button = GUI::Button::construct(); + m_show_desktop_button->set_tooltip("Show Desktop"); + m_show_desktop_button->set_fixed_size(12, 21); + m_show_desktop_button->on_click = TaskbarWindow::show_desktop_button_clicked; + main_widget.add_child(*m_show_desktop_button); + auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af"); m_assistant_app_file = Desktop::AppFile::open(af_path); } @@ -96,6 +102,11 @@ TaskbarWindow::~TaskbarWindow() { } +void TaskbarWindow::show_desktop_button_clicked(unsigned) +{ + GUI::WindowManagerServerConnection::the().async_toggle_show_desktop(); +} + void TaskbarWindow::create_quick_launch_bar() { auto& quick_launch_bar = main_widget()->add<GUI::Frame>(); diff --git a/Userland/Services/Taskbar/TaskbarWindow.h b/Userland/Services/Taskbar/TaskbarWindow.h index b89c604243..2fbb17d402 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.h +++ b/Userland/Services/Taskbar/TaskbarWindow.h @@ -21,6 +21,7 @@ public: private: explicit TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu); + static void show_desktop_button_clicked(unsigned); void create_quick_launch_bar(); void on_screen_rects_change(const Vector<Gfx::IntRect, 4>&, size_t); NonnullRefPtr<GUI::Button> create_button(const WindowIdentifier&); @@ -44,6 +45,7 @@ private: Gfx::IntSize m_applet_area_size; RefPtr<GUI::Frame> m_applet_area_container; RefPtr<GUI::Button> m_start_button; + RefPtr<GUI::Button> m_show_desktop_button; RefPtr<Desktop::AppFile> m_assistant_app_file; |