From d6edb8b2738c894307acccde57a45eca9e3fa113 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Sun, 23 Mar 2025 14:36:16 +0100 Subject: [PATCH] action: Add HideCursor action --- docs/labwc-actions.5.scd | 6 ++++++ src/action.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index 6a46ea6b..13170d77 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -351,6 +351,12 @@ Actions are used in menus and keyboard/mouse bindings. *y* [center|value] Equivalent for the vertical warp position within the target area. Default is "center" +** + Hide the pointer or stylus cursor. The cursor becomes visible again on following + pointer actions, stylus actions or touchpad gestures. + Use together with the WarpCursor action to not just hide the cursor but to + additionally move it away to prevent e.g. hover effects. + **++ **++ ** diff --git a/src/action.c b/src/action.c index aa5d0672..8643bb5e 100644 --- a/src/action.c +++ b/src/action.c @@ -123,6 +123,7 @@ enum action_type { ACTION_TYPE_ZOOM_IN, ACTION_TYPE_ZOOM_OUT, ACTION_TYPE_WARP_CURSOR, + ACTION_TYPE_HIDE_CURSOR, }; const char *action_names[] = { @@ -188,6 +189,7 @@ const char *action_names[] = { "ZoomIn", "ZoomOut", "WarpCursor", + "HideCursor", NULL }; @@ -1335,6 +1337,9 @@ actions_run(struct view *activator, struct server *server, warp_cursor(view, output, to, x, y); } break; + case ACTION_TYPE_HIDE_CURSOR: + cursor_set_visible(&server->seat, false); + break; case ACTION_TYPE_INVALID: wlr_log(WLR_ERROR, "Not executing unknown action"); break;