mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
hide_cursor: Add an option to hide when typing
Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed.
This commit is contained in:
parent
4799cb0960
commit
96578aa91e
7 changed files with 91 additions and 15 deletions
|
|
@ -253,6 +253,32 @@ int cursor_get_timeout(struct sway_cursor *cursor) {
|
|||
return timeout;
|
||||
}
|
||||
|
||||
void cursor_notify_key_press(struct sway_cursor *cursor) {
|
||||
if (cursor->hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cursor->hide_when_typing == HIDE_WHEN_TYPING_DEFAULT) {
|
||||
// No cached value, need to lookup in the seat_config
|
||||
const struct seat_config *seat_config = seat_get_config(cursor->seat);
|
||||
if (!seat_config) {
|
||||
seat_config = seat_get_config_by_name("*");
|
||||
if (!seat_config) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
cursor->hide_when_typing = seat_config->hide_cursor_when_typing;
|
||||
// The default is currently disabled
|
||||
if (cursor->hide_when_typing == HIDE_WHEN_TYPING_DEFAULT) {
|
||||
cursor->hide_when_typing = HIDE_WHEN_TYPING_DISABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor->hide_when_typing == HIDE_WHEN_TYPING_ENABLE) {
|
||||
cursor_hide(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
static enum sway_input_idle_source idle_source_from_device(
|
||||
struct wlr_input_device *device) {
|
||||
switch (device->type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue