diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-07 21:48:56 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-07 21:48:56 +0200 |
| commit | fa653337897b327a62b25840bea1713c262f45a6 (patch) | |
| tree | e7e54b0d861cf9eaa504ea9c266f88ed24cc1de9 /src/seat.zig | |
| parent | 15f97314a9a72685a3468dcb72bac4e534b05b35 (diff) | |
| download | river-fa653337897b327a62b25840bea1713c262f45a6.tar.gz river-fa653337897b327a62b25840bea1713c262f45a6.tar.xz | |
Refactor keybindings to be runtime defined.
Diffstat (limited to 'src/seat.zig')
| -rw-r--r-- | src/seat.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/seat.zig b/src/seat.zig index 8767323..eacdf8d 100644 --- a/src/seat.zig +++ b/src/seat.zig @@ -41,6 +41,19 @@ pub const Seat = struct { self.cursor.destroy(); } + /// Handle any user-defined keybinding for the passed keysym and modifiers + /// Returns true if the key was handled + pub fn handleKeybinding(self: Self, keysym: c.xkb_keysym_t, modifiers: u32) bool { + for (self.server.config.keybinds.items) |keybind| { + if (modifiers == keybind.modifiers and keysym == keybind.keysym) { + // Execute the bound command + keybind.command(self.server, keybind.arg); + return true; + } + } + return false; + } + fn addKeyboard(self: *Self, device: *c.wlr_input_device) !void { c.wlr_seat_set_keyboard(self.wlr_seat, device); |
