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 /include/sway/config.h | |
parent | bfa20e65d846f8e8bf7b967b2440d99d82ca9a86 (diff) |
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 'include/sway/config.h')
-rw-r--r-- | include/sway/config.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 7c544541..8970696c 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -4,6 +4,7 @@ #include <stdint.h> #include <string.h> #include <time.h> +#include <wlr/interfaces/wlr_switch.h> #include <wlr/types/wlr_box.h> #include <xkbcommon/xkbcommon.h> #include "../include/config.h" @@ -29,6 +30,7 @@ enum binding_input_type { BINDING_KEYSYM, BINDING_MOUSECODE, BINDING_MOUSESYM, + BINDING_SWITCH }; enum binding_flags { @@ -61,6 +63,16 @@ struct sway_mouse_binding { }; /** + * A laptop switch binding and an associated command. + */ +struct sway_switch_binding { + enum wlr_switch_type type; + enum wlr_switch_state state; + uint32_t flags; + char *command; +}; + +/** * Focus on window activation. */ enum sway_fowa { @@ -78,6 +90,7 @@ struct sway_mode { list_t *keysym_bindings; list_t *keycode_bindings; list_t *mouse_bindings; + list_t *switch_bindings; bool pango; }; @@ -603,6 +616,8 @@ int sway_binding_cmp_keys(const void *a, const void *b); void free_sway_binding(struct sway_binding *sb); +void free_switch_binding(struct sway_switch_binding *binding); + void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); void load_swaybar(struct bar_config *bar); |