aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-03-28 14:44:48 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2020-03-28 14:44:48 +0100
commit866f2c7614ec23f1ef796c0eb67aca1d080a3bfc (patch)
tree297a37bd5899c50d824edbef6789c88117bd3e27 /src
parentca2e1695350d696cbce00ef71823c1ab958c11c0 (diff)
downloadriver-866f2c7614ec23f1ef796c0eb67aca1d080a3bfc.tar.gz
river-866f2c7614ec23f1ef796c0eb67aca1d080a3bfc.tar.xz
Add keybindings for changing master count
Diffstat (limited to 'src')
-rw-r--r--src/server.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server.zig b/src/server.zig
index 30b06d5..0d17957 100644
--- a/src/server.zig
+++ b/src/server.zig
@@ -105,6 +105,8 @@ pub const Server = struct {
c.wl_display_run(self.wl_display);
}
+ /// Handle all compositor keybindings
+ /// Note: this is a hacky initial implementation for testing and will be rewritten eventually
pub fn handleKeybinding(self: *Self, sym: c.xkb_keysym_t, modifiers: u32) bool {
// This function assumes the proper modifier is held down.
if (modifiers & @intCast(u32, c.WLR_MODIFIER_SHIFT) != 0) {
@@ -124,6 +126,18 @@ pub const Server = struct {
c.XKB_KEY_e => c.wl_display_terminate(self.wl_display),
c.XKB_KEY_j => self.root.focusNextView(),
c.XKB_KEY_k => self.root.focusPrevView(),
+ c.XKB_KEY_h => {
+ if (self.root.master_count < self.root.views.len) {
+ self.root.master_count += 1;
+ self.root.arrange();
+ }
+ },
+ c.XKB_KEY_l => {
+ if (self.root.master_count > 0) {
+ self.root.master_count -= 1;
+ self.root.arrange();
+ }
+ },
c.XKB_KEY_Return => {
// Spawn an instance of alacritty
// const argv = [_][]const u8{ "/bin/sh", "-c", "WAYLAND_DEBUG=1 alacritty" };