aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-02-14 18:13:15 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2021-02-14 18:13:15 +0100
commit6470d8c776343fed30032ad96f75f7d78aac0a18 (patch)
treec03171e93a0b73ce50e57328b9b6dbc44ea8cad4
parent5c0be25142a7c568e144257e5638343e327bef46 (diff)
downloadriver-6470d8c776343fed30032ad96f75f7d78aac0a18.tar.gz
river-6470d8c776343fed30032ad96f75f7d78aac0a18.tar.xz
command: silently ignore re-declaring a mode
This change is made in the interest of allowing users to simply re-run their init script at runtime without errors. Making this an error doesn't really gain us anything.
-rw-r--r--river/command/declare_mode.zig9
1 files changed, 1 insertions, 8 deletions
diff --git a/river/command/declare_mode.zig b/river/command/declare_mode.zig
index a5ba771..36634aa 100644
--- a/river/command/declare_mode.zig
+++ b/river/command/declare_mode.zig
@@ -37,14 +37,7 @@ pub fn declareMode(
const config = &seat.input_manager.server.config;
const new_mode_name = args[1];
- if (config.mode_to_id.get(new_mode_name) != null) {
- out.* = try std.fmt.allocPrint(
- allocator,
- "mode '{}' already exists and cannot be re-declared",
- .{new_mode_name},
- );
- return Error.Other;
- }
+ if (config.mode_to_id.get(new_mode_name) != null) return;
try config.modes.ensureCapacity(config.modes.items.len + 1);
const owned_name = try std.mem.dupe(util.gpa, u8, new_mode_name);