mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Add ToggleKeybinds action
This can be used to better control Virtual Machines, VNC clients, nested compositors or similar. All keybinds other than ToggleKeybinds itself are disabled when first called, a 2nd call will restore handling of all keybinds. Fixes #738 Fixes #810
This commit is contained in:
parent
d571b0b28a
commit
c33a404dc1
5 changed files with 35 additions and 1 deletions
21
src/action.c
21
src/action.c
|
|
@ -59,7 +59,8 @@ enum action_type {
|
|||
ACTION_TYPE_RESIZE,
|
||||
ACTION_TYPE_GO_TO_DESKTOP,
|
||||
ACTION_TYPE_SEND_TO_DESKTOP,
|
||||
ACTION_TYPE_SNAP_TO_REGION
|
||||
ACTION_TYPE_SNAP_TO_REGION,
|
||||
ACTION_TYPE_TOGGLE_KEYBINDS,
|
||||
};
|
||||
|
||||
const char *action_names[] = {
|
||||
|
|
@ -88,6 +89,7 @@ const char *action_names[] = {
|
|||
"GoToDesktop",
|
||||
"SendToDesktop",
|
||||
"SnapToRegion",
|
||||
"ToggleKeybinds",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -169,6 +171,18 @@ action_create(const char *action_name)
|
|||
return action;
|
||||
}
|
||||
|
||||
bool
|
||||
actions_contain_toggle_keybinds(struct wl_list *action_list)
|
||||
{
|
||||
struct action *action;
|
||||
wl_list_for_each(action, action_list, link) {
|
||||
if (action->type == ACTION_TYPE_TOGGLE_KEYBINDS) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void action_list_free(struct wl_list *action_list)
|
||||
{
|
||||
struct action_arg *arg, *arg_tmp;
|
||||
|
|
@ -451,6 +465,11 @@ actions_run(struct view *activator, struct server *server,
|
|||
wlr_log(WLR_ERROR, "Invalid SnapToRegion id: '%s'", region_name);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_TOGGLE_KEYBINDS:
|
||||
server->seat.inhibit_keybinds = !server->seat.inhibit_keybinds;
|
||||
wlr_log(WLR_DEBUG, "%s keybinds",
|
||||
server->seat.inhibit_keybinds ? "Disabled" : "Enabled");
|
||||
break;
|
||||
case ACTION_TYPE_INVALID:
|
||||
wlr_log(WLR_ERROR, "Not executing unknown action");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue