Taskbar: Add show desktop button to toggle showing of the desktop

This commit is contained in:
ForLoveOfCats 2021-06-28 21:00:12 -04:00 committed by Gunnar Beutner
parent 271840ca22
commit cefa2e3dd2
Notes: sideshowbarker 2024-07-18 10:30:43 +09:00
2 changed files with 13 additions and 0 deletions

View File

@ -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>();

View File

@ -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;