Stores the keyboard layout either globally or per window and restores
it when switching back to the window. Default is global.
-*<keyboard><keybind key="" layoutDependent="" onRelease="">*
+*<keyboard><keybind key="" layoutDependent="" onRelease="" allowWhenLocked="">*
Define a *key* binding in the format *modifier-key*, where supported
modifiers are:
- S (shift)
</keybind>
```
+ *allowWhenLocked* [yes|no]
+ Make this keybind work even if the screen is locked. Default is no.
+
*<keyboard><keybind key=""><action name="">*
Keybind action. See labwc-actions(5).
set_bool(content, ¤t_keybind->on_release);
} else if (!strcasecmp(nodename, "layoutDependent")) {
set_bool(content, ¤t_keybind->use_syms_only);
+ } else if (!strcasecmp(nodename, "allowWhenLocked")) {
+ set_bool(content, ¤t_keybind->allow_when_locked);
} else if (!strcmp(nodename, "name.action")) {
current_keybind_action = action_create(content);
if (current_keybind_action) {
struct server *server = seat->server;
struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
struct keyinfo keyinfo = get_keyinfo(wlr_keyboard, event->keycode);
+ bool locked = seat->server->session_lock_manager->locked;
key_state_set_pressed(event->keycode,
event->state == WL_KEYBOARD_KEY_STATE_PRESSED,
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
if (cur_keybind && cur_keybind->on_release) {
key_state_bound_key_remove(event->keycode);
- if (seat->server->session_lock_manager->locked) {
+ if (locked && !cur_keybind->allow_when_locked) {
cur_keybind = NULL;
return true;
}
* It's important to do this after key_state_set_pressed() to ensure
* _all_ key press/releases are registered
*/
- if (seat->server->session_lock_manager->locked) {
- return false;
- }
-
- if (server->input_mode == LAB_INPUT_STATE_MENU) {
- key_state_store_pressed_key_as_bound(event->keycode);
- handle_menu_keys(server, &keyinfo.translated);
- return true;
- }
+ if (!locked) {
+ if (server->input_mode == LAB_INPUT_STATE_MENU) {
+ key_state_store_pressed_key_as_bound(event->keycode);
+ handle_menu_keys(server, &keyinfo.translated);
+ return true;
+ }
- if (server->osd_state.cycle_view) {
- key_state_store_pressed_key_as_bound(event->keycode);
- handle_cycle_view_key(server, &keyinfo);
- return true;
+ if (server->osd_state.cycle_view) {
+ key_state_store_pressed_key_as_bound(event->keycode);
+ handle_cycle_view_key(server, &keyinfo);
+ return true;
+ }
}
/*
* Handle compositor keybinds
*/
cur_keybind = match_keybinding(server, &keyinfo, keyboard->is_virtual);
- if (cur_keybind) {
+ if (cur_keybind && (!locked || cur_keybind->allow_when_locked)) {
/*
* Update key-state before action_run() because the action
* might lead to seat_focus() in which case we pass the