summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorJan Grau <jan.grau95@gmail.com>2022-02-23 21:49:24 +0100
committerLinus Groh <mail@linusgroh.de>2022-02-24 18:57:20 +0000
commit9311b685fe46fcde1d8defe8f5220c7bba18e532 (patch)
tree8e94d9bc26eedc79d90b82247919762d1fb2b439 /Userland/Services
parent6992a07afcdce14f316490b8a26e116d3f5e8059 (diff)
downloadserenity-9311b685fe46fcde1d8defe8f5220c7bba18e532.zip
Taskbar: Minimize/activate window on Super+Digit event
Handle the SuperDigitKeyPressed event in the taskbar. Toggle the respective taskbar button.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/Taskbar/TaskbarWindow.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp
index 9e0614e4c8..4fd243e265 100644
--- a/Userland/Services/Taskbar/TaskbarWindow.cpp
+++ b/Userland/Services/Taskbar/TaskbarWindow.cpp
@@ -334,6 +334,24 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
warnln("failed to spawn 'Assistant' when requested via Super+Space");
break;
}
+ case GUI::Event::WM_SuperDigitKeyPressed: {
+ auto& digit_event = static_cast<GUI::WMSuperDigitKeyPressedEvent&>(event);
+ auto index = digit_event.digit() != 0 ? digit_event.digit() - 1 : 9;
+
+ for (auto& widget : m_task_button_container->child_widgets()) {
+ // NOTE: The button might be invisible depending on the current workspace
+ if (!widget.is_visible())
+ continue;
+
+ if (index == 0) {
+ static_cast<TaskbarButton&>(widget).click();
+ break;
+ }
+
+ --index;
+ }
+ break;
+ }
case GUI::Event::WM_WorkspaceChanged: {
auto& changed_event = static_cast<GUI::WMWorkspaceChangedEvent&>(event);
workspace_change_event(changed_event.current_row(), changed_event.current_column());