Add onRelease option to <keybind>

...to make keybind actions fire on the release event rather then when the
key is first pressed. This is useful for binding actions to modifier keys
only. The most likely use-case for this is the binding of a Super key to a
menu, for example:

    <keybind key="Super_L" onRelease="yes">
      <action name="Execute" command="rofi -show drun"/>
    </keybind>

If another keybind is issued between the press and release, the on-release
keybind is cancelled.

Co-authored-by: @johanmalm
This commit is contained in:
Simon Long 2024-04-26 11:05:12 +01:00 committed by Johan Malm
parent f6c91c8d13
commit 84c222a84f
6 changed files with 51 additions and 5 deletions

View file

@ -403,6 +403,8 @@ fill_keybind(char *nodename, char *content)
} else if (!current_keybind) {
wlr_log(WLR_ERROR, "expect <keybind key=\"\"> element first. "
"nodename: '%s' content: '%s'", nodename, content);
} else if (!strcasecmp(nodename, "onRelease")) {
set_bool(content, &current_keybind->on_release);
} else if (!strcasecmp(nodename, "layoutDependent")) {
set_bool(content, &current_keybind->use_syms_only);
} else if (!strcmp(nodename, "name.action")) {