aboutsummaryrefslogtreecommitdiff
path: root/src/Seat.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-05-26 22:55:07 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-05-31 21:04:25 +0200
commitd9ca9db5a49f0af2f6bef6f198b28a8d29808e6d (patch)
treeebeb7de70a63bfff951e9eaa069f7885aa34a2dc /src/Seat.zig
parent9cd61f75903a83e56538ae3d69e7c2f3d2e6ca10 (diff)
downloadriver-d9ca9db5a49f0af2f6bef6f198b28a8d29808e6d.tar.gz
river-d9ca9db5a49f0af2f6bef6f198b28a8d29808e6d.tar.xz
Rework commands to be string based
This allows for significantly more flexibility and should make implementing the bind command possible.
Diffstat (limited to 'src/Seat.zig')
-rw-r--r--src/Seat.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Seat.zig b/src/Seat.zig
index 3ff3667..7e0b06b 100644
--- a/src/Seat.zig
+++ b/src/Seat.zig
@@ -20,6 +20,7 @@ const Self = @This();
const std = @import("std");
const c = @import("c.zig");
+const command = @import("command.zig");
const Cursor = @import("Cursor.zig");
const InputManager = @import("InputManager.zig");
@@ -252,7 +253,13 @@ pub fn handleKeybinding(self: *Self, keysym: c.xkb_keysym_t, modifiers: u32) boo
for (self.mode.keybinds.items) |keybind| {
if (modifiers == keybind.modifiers and keysym == keybind.keysym) {
// Execute the bound command
- keybind.command.run(self);
+ const allocator = self.input_manager.server.allocator;
+ var failure_message: []const u8 = undefined;
+ command.run(allocator, self, keybind.command_args, &failure_message) catch |err| {
+ // TODO: log the error
+ if (err == command.Error.CommandFailed)
+ allocator.free(failure_message);
+ };
return true;
}
}