From 29a228674bc47720fc0a0e35fbb478d1cae8b66d Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Tue, 7 Nov 2023 18:53:27 +0000 Subject: [PATCH] Add unfocus action ...to enable unfocusing currently focused window on desktop click. Works with: Fixes: #1230 --- docs/labwc-actions.5.scd | 3 +++ src/action.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index 1a65bcda..5b2463bb 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -27,6 +27,9 @@ Actions are used in menus and keyboard/mouse bindings. ** Give focus to window under cursor. +** + Remove focus from the window that is currently focused. + ** Restack the current window above other open windows. diff --git a/src/action.c b/src/action.c index 26d609bb..6cd809e4 100644 --- a/src/action.c +++ b/src/action.c @@ -79,6 +79,7 @@ enum action_type { ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP, ACTION_TYPE_TOGGLE_ALWAYS_ON_BOTTOM, ACTION_TYPE_FOCUS, + ACTION_TYPE_UNFOCUS, ACTION_TYPE_ICONIFY, ACTION_TYPE_MOVE, ACTION_TYPE_RAISE, @@ -120,6 +121,7 @@ const char *action_names[] = { "ToggleAlwaysOnTop", "ToggleAlwaysOnBottom", "Focus", + "Unfocus", "Iconify", "Move", "Raise", @@ -745,6 +747,9 @@ actions_run(struct view *activator, struct server *server, desktop_focus_view(view, /*raise*/ false); } break; + case ACTION_TYPE_UNFOCUS: + seat_focus_surface(&server->seat, NULL); + break; case ACTION_TYPE_ICONIFY: if (view) { view_minimize(view, true);