diff options
author | Ryan Walklin <ryan@testtoast.com> | 2019-03-20 14:47:29 +1100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-03-19 23:58:47 -0400 |
commit | bdb402404cd6d54242b0b1dc2360cfc5679e52f2 (patch) | |
tree | 5a355e025c24b3de0bc69db4b8cc9d002bbd1167 /sway/config.c | |
parent | Clean up focus follows mouse logic (diff) | |
download | sway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.tar.gz sway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.tar.zst sway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.zip |
Support WLR_INPUT_DEVICE_SWITCH in sway
This commit adds support for laptop lid and tablet
mode switches as provided by evdev/libinput and
handled by wlroots.
Adds a new bindswitch command with syntax:
bindswitch <switch>:<state> <command>
Where <switch> is one of:
tablet for WLR_SWITCH_TYPE_TABLET_MODE
lid for WLR_SWITCH_TYPE_LID
<state> is one of:
on for WLR_SWITCH_STATE_ON
off for WLR_SWITCH_STATE_OFF
toggle for WLR_SWITCH_STATE_TOGGLE
(Note that WLR_SWITCH_STATE_TOGGLE doesn't map to
libinput and will trigger at both on and off events)
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 48bbd1ea..7104f55d 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -56,6 +56,12 @@ static void free_mode(struct sway_mode *mode) { | |||
56 | } | 56 | } |
57 | list_free(mode->mouse_bindings); | 57 | list_free(mode->mouse_bindings); |
58 | } | 58 | } |
59 | if (mode->switch_bindings) { | ||
60 | for (int i = 0; i < mode->switch_bindings->length; i++) { | ||
61 | free_switch_binding(mode->switch_bindings->items[i]); | ||
62 | } | ||
63 | list_free(mode->switch_bindings); | ||
64 | } | ||
59 | free(mode); | 65 | free(mode); |
60 | } | 66 | } |
61 | 67 | ||
@@ -195,6 +201,7 @@ static void config_defaults(struct sway_config *config) { | |||
195 | if (!(config->current_mode->keysym_bindings = create_list())) goto cleanup; | 201 | if (!(config->current_mode->keysym_bindings = create_list())) goto cleanup; |
196 | if (!(config->current_mode->keycode_bindings = create_list())) goto cleanup; | 202 | if (!(config->current_mode->keycode_bindings = create_list())) goto cleanup; |
197 | if (!(config->current_mode->mouse_bindings = create_list())) goto cleanup; | 203 | if (!(config->current_mode->mouse_bindings = create_list())) goto cleanup; |
204 | if (!(config->current_mode->switch_bindings = create_list())) goto cleanup; | ||
198 | list_add(config->modes, config->current_mode); | 205 | list_add(config->modes, config->current_mode); |
199 | 206 | ||
200 | config->floating_mod = 0; | 207 | config->floating_mod = 0; |