aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/keyboard.c
Commit message (Collapse)AuthorAge
* input: add Super as alternative for Mod4Libravatar Ferdinand Bachmann2024-04-05
| | | | This PR implements alternative human-readable names for the logo key (Mod4) as proposed in #8084.
* scene_graph: Port ext_session_v1Libravatar Alexander Orzechowski2024-01-18
|
* input/{keyboard,switch}: rename input_inhibited variable to lockedLibravatar Simon Ser2023-12-13
| | | | This is more descriptive now.
* input/seat: drop exclusive_clientLibravatar Simon Ser2023-12-13
| | | | This was a input-inhibit concept.
* Drop support for KDE's idle protocolLibravatar Simon Ser2023-10-05
| | | | We support the standard idle-notify protocol since Sway 1.8.
* Use format_str() throughoutLibravatar Simon Ser2023-04-14
|
* input: enable user xkb configs with cap_sys_niceLibravatar Ronan Pigott2023-01-11
|
* seat: Set keyboard if seat keyboard is NULLLibravatar Kenny Levinsen2022-12-19
| | | | | | | | | | | | | | | sway sends wl_keyboard.enter on seat focus change and when a keyboard active on a seat is configured. If all keyboards are removed and a keyboard is added back without changing the focused client, no new notify event would be sent despite having keyboard focus. This could lead to key events without notify, which is a protocol violation. As a quick fix, when configuring a keyboard on a seat where no keyboard is currently active, activate the keyboard so that a focused surface will receive a notify event. Regressed by: e1b268af98edeb09e570e8855ef64f0719cbafe2 Closes: https://github.com/swaywm/sway/issues/7330
* seat: Avoid sending redundant keymaps on reloadLibravatar Kenny Levinsen2022-12-04
| | | | | | | | | | | | | | | | | | | When we reload the config, we reset every input device and re-apply configuration from the config file. This means that the keyboard keymap is updated at least once during config reload, more if the config file contains keyboard configuration. When they keyboard keymap changes and is updated through wlr_seat, the keymap ends up sent to every keyboard bound in every client, seemingly multiple times. On an x230 of mine with a keyboard layout set in the config file, I see 42 keymap events sent to foot on config reload. Reduce events from keyboard configurations by skipping all but the currently active keyboard for the seat, and by clearing the active keyboard during input manager device reset. After this change, I only see a single just-in-time keymap event. Fixes: https://github.com/swaywm/sway/issues/6654
* Make session optionalLibravatar Simon Ser2022-11-28
|
* Update for wlroots!3814Libravatar Simon Ser2022-11-15
| | | | References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3814
* Remove access to wlr_input_device unionLibravatar Simon Ser2022-06-22
| | | | | References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626 Closes: https://github.com/swaywm/sway/issues/7077
* Implement ext-session-lock-v1Libravatar Daniel De Graaf2022-04-29
|
* sway/input: wlr_seat_keyboard() now takes wlr_keyboardLibravatar Leonardo Hernández Hernández2022-03-23
|
* sway/input: follow up wlroots input device events renamingLibravatar Simon Zeni2022-03-17
|
* sway/input: use wlr_input_device from input device baseLibravatar Simon Zeni2022-02-21
|
* Implement input method keyboard grabLibravatar xdavidwu2021-03-12
|
* input: Only commit transactions when necessaryLibravatar Kenny Levinsen2021-02-14
| | | | | | | | | | | There is no need to check for transactions at the end of every user input, as the vast majority of input will not issue transactions. This implementation can also hide where changes are made without an appropriate transaction commit, as a future unrelated input would issue the commit instead. Instead, commit transactions in places where changes are made or are likely to be made.
* input/keyboard: fix Group# bindings for keyboard groupsLibravatar Brian Ashworth2020-11-12
| | | | | | The keyboard group's effective keyboard layout was never being changed due to a condition that incorrectly preventing it from being performed. The IPC event that follows the change was correctly being prevented.
* Replace wlr_key_state with wl_keyboard_key_stateLibravatar Simon Ser2020-11-11
| | | | References: https://github.com/swaywm/wlroots/pull/2446
* hide_cursor: Add an option to hide when typingLibravatar Tamir Zahavi-Brunner2020-10-30
| | | | | Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed.
* input/keyboard: wlr_keyboard_group enter and leaveLibravatar Brian Ashworth2020-06-16
| | | | | | | | This adds support for wlr_keyboard_group's enter and leave events. The enter event just updates the keyboard's state. The leave event updates the keyboard's state and if the surface was notified of a press event for any of the keycodes, it is refocused so that it can pick up the current keyboard state without triggering any keybinds.
* input: fix reloading crash due to keyboard group configuringLibravatar Brian Ashworth2020-05-19
| | | | | | | | | | | | | | | | | | Keyboard group keyboards should not call sway_keyboard_configure. They do not have an input config and they derive their state from the keyboards within the group. For some reason, I got sway_keyboard_configure and seat_configure_keyboard mixed up and thought seat_reset_device called the latter. Calling sway_keyboard_configure with a keyboard group's keyboard is not supported and can cause issues. If any clients are listening to the ipc input event, a sigsegv will occur due to not every property - such as identifier - being wired up for keyboard group keyboard's. This also adds an assertion to sway_keyboard_configure to ensure that this does not occur in the future and any instances are quickly caught.
* input/keyboard: use wlr_keyboard_keymaps_match from wlrootsLibravatar Tudor Brindus2020-05-08
| | | | | Added in swaywm/wlroots#2172, so that sway doesn't need to maintain an independent copy of this function.
* input: keyboard: Never group virtual keyboards.Libravatar Andri Yngvason2020-04-14
| | | | This fixes #5134
* add --no-repeat option for bindingsLibravatar Linus Heckemann2020-03-30
| | | | | | | | | This allows e.g. triggering one command while a key is held, then triggering another to undo the change performed by it afterwards. One use case for this is triggering push-to-talk functionality for VoIP tools without granting them full access to all input events. Fixes #3151
* input: Add support for keyboard shortcuts inhibitLibravatar Michael Weiser2020-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adding support for the keyboard shortcuts inhibit protocol allows remote desktop and virtualisation software to receive all keyboard input in order to pass it through to their clients so users can fully interact the their remote/virtual session. The software usually provides its own key combination to release its "grab" to all keyboard input. The inhibitor can be deactivated by the user by removing focus from the surface using another input device such as the pointer. Use support for the procotol in wlroots to add support to sway. Extend the input manager with handlers for inhibitor creation and destruction and appropriate bookkeeping. Attach the inhibitors to the seats they apply to to avoid having to search the list of all currently existing inhibitors on every keystroke and passing the inhibitor manager around. Add a helper function to retrieve the inhibitor applying to the currently focused surface of a seat, if one exists. Extend bindsym with a flag for bindings that should be processed even if an inhibitor is active. Conversely this disables all normal shortcuts if an inhibitor is found for the currently focused surface in keyboard::handle_key_event() since they don't have that flag set. Use above helper function to determine if an inhibitor exists for the surface that would eventually receive input. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* seat_cmd_keyboard_grouping: change keymap to smartLibravatar Brian Ashworth2019-12-16
| | | | | | | | | | This removes `seat <seat> keyboard_grouping keymap` and replaces it with `seat <seat> keyboard_grouping smart`. The smart keyboard grouping will group based on both the keymap and repeat info. The reasoning for this is that deciding what the repeat info should be for a group is either arbitrary or non-deterministic when multiple keyboards in the group have repeat info configured (unless somehow exposed to the user in a reproducible uniquely identifiable fashion).
* input/keyboard: defer wlr_keyboard_group destroyLibravatar Brian Ashworth2019-12-13
| | | | | | | | | | This defers the destruction of wlr_keyboard_groups until idle. This is to prevent the keyboard group's keyboard from being destroyed in the middle of handling a keyboard event. This would occur when changing the keymap of the last keyboard in a group with a keyboard binding. The prevents crashing when attempting to update the xkb state of the keyboard group's keyboard. The sway_keyboard_group is still immediately destroyed so that the group is no longer used
* input/keyboard: remove group listeners on destroyLibravatar Brian Ashworth2019-12-13
| | | | | | | This adds two missing calls to wl_list_remove to remove the key and modifier listeners for the keyboard group's keyboard when destroying the keyboard group. This fixes some crashes when changing the keymap of the last keyboard in a group with a keyboard binding.
* Add seat <seat> idle_{inhibit,wake} <sources...>Libravatar Drew DeVault2019-12-12
| | | | | | | | | | This adds seat configuration options which can be used to configure what events affect the idle behavior of sway. An example use-case is mobile devices: you would remove touch from the list of idle_wake events. This allows the phone to stay on while you're actively using it, but doesn't wake from idle on touch events while it's sleeping in your pocket.
* input/keyboard: reset seat keyboard on destroyLibravatar Brian Ashworth2019-11-28
| | | | | | | | | | | If a sway keyboard is being destroyed, then the keyboard is being removed from a seat. If the associated wlr_keyboard is the currently set keyboard for the wlr_seat, then we need to reset the wlr_seat's keyboard to NULL so it doesn't reference an invalid device for the seat. The next configured keyboard from the seat or the next keyboard from that seat that has an event will then become the seat keyboard. Similarly, this needs to be done for a wlr_keyboard_group's keyboard when the wlr_keyboard_group is being destroyed.
* input/keyboard: check keyboard group before removeLibravatar Brian Ashworth2019-11-26
| | | | | | In sway_keyboard_destroy, only remove the keyboard from a keyboard group, if it is part of a keyboard group. If the keyboard is not part of a keyboard group, then there is nothing to remove it from
* Add support for wlr_keyboard_groupLibravatar Brian Ashworth2019-11-21
| | | | | | | | | | | | | | | | | A wlr_keyboard_group allows for multiple keyboard devices to be combined into one logical keyboard. This is useful for keyboards that are split into multiple input devices despite appearing as one physical keyboard in the user's mind. This adds support for wlr_keyboard_groups to sway. There are two keyboard groupings currently supported, which can be set on a per-seat basis. The first keyboard grouping is none, which disables all grouping and provides no functional change. The second is keymap, which groups the keyboard devices in the seat by their keymap. With this grouping, the effective layout and repeat info is also synced across keyboard devices in the seat. Device specific bindings will still be executed as normal, but everything else related to key and modifier events will be handled by the keyboard group's keyboard.
* input/keyboard: cleanup xkb_file error handingLibravatar Brian Ashworth2019-11-21
| | | | | This fixes an inverted fclose return value check and simplifies the error handling and logging for xkb_file in sway_keyboard_compile_keymap
* input/keyboard: send released only if pressed sentLibravatar Brian Ashworth2019-08-20
| | | | | | | | | | This keeps track of whether surfaces received a key press event and will only send a key release event if the pressed event was sent. This also requires changing the keycodes that are sent via wl_keyboard_enter to only include those that were previously sent. This makes it so surfaces do not receive key release events for keys that they never received a key press for and makes it so switching focus doesn't leak keycodes that were consumed by bindings.
* bindsym/code: add group supportLibravatar Brian Ashworth2019-08-01
| | | | | | | | | | | This adds support for specifying a binding for a specific group. Any binding without a group listed will be available in all groups. The priority for matching bindings is as follows: input device, group, and locked state. For full compatibility with i3, this also adds Mode_switch as an alias for Group2. Since i3 only supports this for backwards compatibility with older versions of i3, it is implemented here, but not documented.
* input/keyboard: don't reset layout for same keymapLibravatar Brian Ashworth2019-08-01
| | | | | | | In sway_keyboard_config, do not change the keymap when the new keymap is unchanged, unless this is during a config reload. The reasoning for this is to prevent the effective layout from being reset to index 0 for input config changes unrelated to the keymap.
* ipc: add an input eventLibravatar Brian Ashworth2019-07-23
| | | | | | | | | This adds an ipc event related to input devices. Currently the following changes are supported: - added: when an input device becomes available - removed: when an input device is no longer available - xkb_keymap_changed: (keyboards only) the keymap changed - xkb_layout_changed: (keyboards only) the effective layout changed
* Implement input_cmd_xkb_file (#3999)Libravatar Ed Younis2019-07-17
| | | | | | | Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program.
* commands/input: perform basic keymap validationLibravatar Brian Ashworth2019-06-09
| | | | | | | | | | | | | Before the delta input config is stored, this attempts to compile a keymap with it. If the keymap fails to compile, then the first line of the xkbcommon log entry will be included with a `CMD_FAILURE`, the entire xkbcommon log entry will be included in the sway error log, and the delta will not be stored. This only handles basic issues such as a layouts not existing. This will NOT catch more complex issues such as when a variant does exist, but not for the given layout (ex: `azerty` is a valid variant, but the `us` layout does not have a `azerty` variant).
* bindings: allow unlocked and locked bindingsLibravatar Brian Ashworth2019-05-30
| | | | | | | | | | | | | | | | This changes the behavior of bindings to make the `BINDING_LOCKED` flag conflicting, which will allow for both unlocked and locked bindings. If there are two matching bindings and one has `--locked` and the other does not, the one with `--locked` will be preferred when locked and the one without will be preferred when unlocked. If there are two matching bindings and one has both a matching `--input-device=<input>` and `--locked` and the other has neither, the former will be preferred for both unlocked and locked. This also refactors `get_active_binding` in `sway/input/keyboard.c` to make it easier to read.
* input/keyboard: attempt default keymap on failureLibravatar Brian Ashworth2019-05-14
| | | | | | | | | | | | | This attempts to use the default keymap when the one defined in the input config fails to compile. The goal is to make it so the keyboard is always in a usable state, even if it is not the user's requested settings as usability is more important. This also removes the calls to `getenv` for the `XKB_DEFAULT_*` family of environment variables. The reasoning is libxkbcommon will fallback to using those (and then the system defaults) when any of the rule names are `NULL` or an empty string anyway so there is no need for sway to duplicate the efforts.
* bindsym: change xkb_rule_names initializationLibravatar Konstantin Pospelov2019-04-26
|
* bindsym: consider xkb_rule_names for --to-codeLibravatar Konstantin Pospelov2019-04-26
|
* ipc: fix criteria for emitting bar_state_updateLibravatar Brian Ashworth2019-04-20
| | | | | | | | | | | | | | This fixes the criteria for emitting a `bar_state_update` event to notify swaybar (and any other bars utilizing the event) on whether the bar is visible by modifier. It is not enough to only emit the event when both the bar mode and bar hidden state are `hide` since it is possible to release the modifier while hidden state is `show` and then change hidden state to `hide` without pressing the modifier. This also emits the event whenever visible by modifier is set and should no longer be regardless of the mode and state to ensure that it gets properly cleared. If visible by modifier is not set and the bar is not in `hide`/`hide`, then no events will be sent and visible by modifier will not be set
* Make raw keysyms take precedence over translatedLibravatar Ben Challenor2019-03-10
| | | | | Allows both BackSpace and Shift+BackSpace to be bound under the US keyboard layout, per #3705.
* input/keyboard: respect solo repeat_{rate,delay}Libravatar Brian Ashworth2019-02-10
| | | | | | If `repeat_rate` or `repeat_delay` is set without the other being set, the default was being used for both. This changes the logic to respect the value given and use the default for the other when only one is set.
* bar_cmd_modifier: add support for noneLibravatar Brian Ashworth2019-02-08
| | | | | | | | sway-bar(5) documents `modifier none`, which comes from i3. This implements the functionality for `modifier none` since it was not previously implemented. The bar modifier toggles visibility of the bar when the bar mode is set to hide. When the bar modifier is set to `none`, the ability to toggle visibility of the bar will be disabled.
* Move sway-specific functions in common/util.c into sway/Libravatar M Stoeckl2019-01-21
| | | | | | Modifier handling functions were moved into sway/input/keyboard.c; opposite_direction for enum wlr_direction into sway/tree/output.c; and get_parent_pid into sway/tree/root.c .