git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit833be9a2e938f2f862692fe83c18b1b176d53e4e
parent8e3ae5bb64
authorIsaac Freund <[email protected]>
date2021-02-14 18:13
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.

 river/command/declare_mode.zig | 9 +--------
 1 file changed, 1 insertion(+), 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);