mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Taskbar: Show start menu when super key is pressed
This commit re-adds the functionality of the start menu appearing when the super key is pressed
This commit is contained in:
parent
88ecfa164a
commit
68d1469aea
2 changed files with 16 additions and 6 deletions
|
@ -84,14 +84,15 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu)
|
|||
main_widget.set_layout<GUI::HorizontalBoxLayout>();
|
||||
main_widget.layout()->set_margins({ 3, 3, 3, 1 });
|
||||
|
||||
auto& start_button = main_widget.add<GUI::Button>("Serenity");
|
||||
start_button.set_font(Gfx::FontDatabase::default_bold_font());
|
||||
start_button.set_icon_spacing(0);
|
||||
start_button.set_fixed_size(80, 22);
|
||||
m_start_button = GUI::Button::construct("Serenity");
|
||||
m_start_button->set_font(Gfx::FontDatabase::default_bold_font());
|
||||
m_start_button->set_icon_spacing(0);
|
||||
m_start_button->set_fixed_size(80, 22);
|
||||
auto app_icon = GUI::Icon::default_icon("ladybug");
|
||||
start_button.set_icon(app_icon.bitmap_for_size(16));
|
||||
start_button.set_menu(m_start_menu);
|
||||
m_start_button->set_icon(app_icon.bitmap_for_size(16));
|
||||
m_start_button->set_menu(m_start_menu);
|
||||
|
||||
main_widget.add_child(*m_start_button);
|
||||
create_quick_launch_bar();
|
||||
|
||||
m_task_button_container = main_widget.add<GUI::Widget>();
|
||||
|
@ -338,6 +339,14 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
|||
update_applet_area();
|
||||
break;
|
||||
}
|
||||
case GUI::Event::WM_SuperKeyPressed: {
|
||||
if (m_start_menu->is_visible()) {
|
||||
m_start_menu->dismiss();
|
||||
} else {
|
||||
m_start_menu->popup(m_start_button->screen_relative_rect().top_left());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue