diff options
author | Olivier De Cannière <olivier.decanniere96@gmail.com> | 2022-06-01 13:40:43 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-06-01 19:31:34 +0200 |
commit | 5a3321b8995dc12cfe16e137b4fb52f12468b108 (patch) | |
tree | 2219409b80f0e4dd81653e69790292b516cc36d2 /Userland/Services | |
parent | 12682f0bcc81c8544cd0c80fe1da984b49eaa0f9 (diff) | |
download | serenity-5a3321b8995dc12cfe16e137b4fb52f12468b108.zip |
Taskbar+Desktop: Add super+D keyboard shortcut
This shortcut has the same effect as pressing the "Show Desktop" button
in the taskbar. This shortcut already exists in Windows.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/Taskbar/TaskbarWindow.cpp | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.cpp | 16 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.h | 1 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManagerClient.ipc | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 0d5e09014d..5b615936d7 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -344,6 +344,10 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) warnln("failed to spawn 'Assistant' when requested via Super+Space"); break; } + case GUI::Event::WM_SuperDKeyPressed: { + toggle_show_desktop(); + 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; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 0091446114..9d45e9326c 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -542,6 +542,17 @@ void WindowManager::tell_wms_super_space_key_pressed() }); } +void WindowManager::tell_wms_super_d_key_pressed() +{ + for_each_window_manager([](WMConnectionFromClient& conn) { + if (conn.window_id() < 0) + return IterationDecision::Continue; + + conn.async_super_d_key_pressed(conn.window_id()); + return IterationDecision::Continue; + }); +} + void WindowManager::tell_wms_super_digit_key_pressed(u8 digit) { for_each_window_manager([digit](WMConnectionFromClient& conn) { @@ -1605,6 +1616,11 @@ void WindowManager::process_key_event(KeyEvent& event) return; } + if (event.type() == Event::KeyDown && event.key() == Key_D) { + tell_wms_super_d_key_pressed(); + return; + } + if (event.type() == Event::KeyDown && event.key() >= Key_0 && event.key() <= Key_9) { auto digit = event.key() - Key_0; tell_wms_super_digit_key_pressed(digit); diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index 115b718350..d49665793b 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -187,6 +187,7 @@ public: void tell_wms_applet_area_size_changed(Gfx::IntSize const&); void tell_wms_super_key_pressed(); void tell_wms_super_space_key_pressed(); + void tell_wms_super_d_key_pressed(); void tell_wms_super_digit_key_pressed(u8); void tell_wms_current_window_stack_changed(); diff --git a/Userland/Services/WindowServer/WindowManagerClient.ipc b/Userland/Services/WindowServer/WindowManagerClient.ipc index 676af0a21f..17d110dfdb 100644 --- a/Userland/Services/WindowServer/WindowManagerClient.ipc +++ b/Userland/Services/WindowServer/WindowManagerClient.ipc @@ -9,6 +9,7 @@ endpoint WindowManagerClient applet_area_size_changed(i32 wm_id, Gfx::IntSize size) =| super_key_pressed(i32 wm_id) =| super_space_key_pressed(i32 wm_id) =| + super_d_key_pressed(i32 wm_id) =| super_digit_key_pressed(i32 wm_id, u8 digit) =| workspace_changed(i32 wm_id, u32 row, u32 column) =| keymap_changed(i32 wm_id, [UTF8] String keymap) =| |