diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-05-17 00:03:26 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-05-17 00:03:26 +0200 |
| commit | 3fe1edbe3edec7967d0d1c67dc7677da9f6a6f4e (patch) | |
| tree | 3886eeb1cecf6f558c98d3776f3235d0ac65aeee /src/Seat.zig | |
| parent | 383260133381e2a9ad515601c2894beac8834945 (diff) | |
| download | river-3fe1edbe3edec7967d0d1c67dc7677da9f6a6f4e.tar.gz river-3fe1edbe3edec7967d0d1c67dc7677da9f6a6f4e.tar.xz | |
Implement keybinding modes
Diffstat (limited to 'src/Seat.zig')
| -rw-r--r-- | src/Seat.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Seat.zig b/src/Seat.zig index 4335c00..c697010 100644 --- a/src/Seat.zig +++ b/src/Seat.zig @@ -25,6 +25,7 @@ const Cursor = @import("Cursor.zig"); const InputManager = @import("InputManager.zig"); const Keyboard = @import("Keyboard.zig"); const LayerSurface = @import("LayerSurface.zig"); +const Mode = @import("Mode.zig"); const Output = @import("Output.zig"); const View = @import("View.zig"); const ViewStack = @import("view_stack.zig").ViewStack; @@ -44,6 +45,9 @@ cursor: Cursor, /// Mulitple keyboards are handled separately keyboards: std.TailQueue(Keyboard), +/// Current keybind mode +mode: *Mode, + /// Currently focused output, may be the noop output if no focused_output: *Output, @@ -72,6 +76,8 @@ pub fn init(self: *Self, input_manager: *InputManager, name: []const u8) !void { self.keyboards = std.TailQueue(Keyboard).init(); + self.mode = input_manager.server.config.getMode("normal"); + self.focused_output = &self.input_manager.server.root.noop_output; self.focused_view = null; @@ -243,7 +249,7 @@ pub fn handleViewUnmap(self: *Self, view: *View) void { /// 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.input_manager.server.config.keybinds.items) |keybind| { + for (self.mode.keybinds.items) |keybind| { if (modifiers == keybind.modifiers and keysym == keybind.keysym) { // Execute the bound command keybind.command(self, keybind.arg); |
