1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

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.
This commit is contained in:
Olivier De Cannière 2022-06-01 13:40:43 +02:00 committed by Andreas Kling
parent 12682f0bcc
commit 5a3321b899
7 changed files with 38 additions and 0 deletions

View file

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

View file

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

View file

@ -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) =|