aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/config.sh8
-rw-r--r--doc/riverctl.1.scd8
-rw-r--r--river/Config.zig6
-rw-r--r--river/command.zig2
-rw-r--r--river/command/filter.zig59
5 files changed, 77 insertions, 6 deletions
diff --git a/contrib/config.sh b/contrib/config.sh
index 3b8355c..6b2cd72 100755
--- a/contrib/config.sh
+++ b/contrib/config.sh
@@ -86,3 +86,11 @@ riverctl map passthrough $mod F11 enter-mode normal
# Set the layout on startup
riverctl layout rivertile left
+
+# Set app-ids of views which should float
+riverctl float-filter-add "float"
+riverctl float-filter-add "popup"
+
+# Set app-ids of views which should use client side decorations
+riverctl csd-filter-add "gedit"
+
diff --git a/doc/riverctl.1.scd b/doc/riverctl.1.scd
index 94b509c..6c104ac 100644
--- a/doc/riverctl.1.scd
+++ b/doc/riverctl.1.scd
@@ -20,9 +20,17 @@ used to control and configure river.
*close*
Close the focused view.
+*csd-filter-add* _app-id_
+ Add an app-id to the CSD filter list. Windows with this app-id are allowed
+ to use client side decoration instead of the default server side decoration.
+
*exit*
Exit the compositor, terminating the Wayland session.
+*float-filter-add* _app-id_
+ Add an app-id to the float filter list. Windows with this app-id will start
+ floating.
+
*focus-output* *next*|*previous*
Focus next or previous output.
diff --git a/river/Config.zig b/river/Config.zig
index 6dc8199..6add4cd 100644
--- a/river/Config.zig
+++ b/river/Config.zig
@@ -78,12 +78,6 @@ pub fn init(self: *Self) !void {
self.csd_filter = std.ArrayList([]const u8).init(util.gpa);
errdefer self.csd_filter.deinit();
-
- // Float views with app_id "float"
- try self.float_filter.append("float");
-
- // Client side decorations for views with app_id "csd"
- try self.csd_filter.append("csd");
}
pub fn deinit(self: Self) void {
diff --git a/river/command.zig b/river/command.zig
index d8e33ae..dc6619d 100644
--- a/river/command.zig
+++ b/river/command.zig
@@ -35,9 +35,11 @@ const str_to_impl_fn = [_]struct {
.{ .name = "border-color-unfocused", .impl = @import("command/config.zig").borderColorUnfocused },
.{ .name = "border-width", .impl = @import("command/config.zig").borderWidth },
.{ .name = "close", .impl = @import("command/close.zig").close },
+ .{ .name = "csd-filter-add", .impl = @import("command/filter.zig").csdFilterAdd },
.{ .name = "declare-mode", .impl = @import("command/declare_mode.zig").declareMode },
.{ .name = "enter-mode", .impl = @import("command/enter_mode.zig").enterMode },
.{ .name = "exit", .impl = @import("command/exit.zig").exit },
+ .{ .name = "float-filter-add", .impl = @import("command/filter.zig").floatFilterAdd },
.{ .name = "focus-output", .impl = @import("command/focus_output.zig").focusOutput },
.{ .name = "focus-view", .impl = @import("command/focus_view.zig").focusView },
.{ .name = "layout", .impl = @import("command/layout.zig").layout },
diff --git a/river/command/filter.zig b/river/command/filter.zig
new file mode 100644
index 0000000..33c5397
--- /dev/null
+++ b/river/command/filter.zig
@@ -0,0 +1,59 @@
+// This file is part of river, a dynamic tiling wayland compositor.
+//
+// Copyright 2020 Leon Henrik Plickat
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+const std = @import("std");
+
+const util = @import("../util.zig");
+
+const Error = @import("../command.zig").Error;
+const Seat = @import("../Seat.zig");
+
+fn appendFilter(
+ allocator: *std.mem.Allocator,
+ list: *std.ArrayList([]const u8),
+ args: []const []const u8,
+) Error!void {
+ if (args.len < 2) return Error.NotEnoughArguments;
+ if (args.len > 2) return Error.TooManyArguments;
+ try list.append(try std.mem.dupe(allocator, u8, args[1]));
+}
+
+pub fn floatFilterAdd(
+ allocator: *std.mem.Allocator,
+ seat: *Seat,
+ args: []const []const u8,
+ out: *?[]const u8,
+) Error!void {
+ try appendFilter(
+ allocator,
+ &seat.input_manager.server.config.float_filter,
+ args,
+ );
+}
+
+pub fn csdFilterAdd(
+ allocator: *std.mem.Allocator,
+ seat: *Seat,
+ args: []const []const u8,
+ out: *?[]const u8,
+) Error!void {
+ try appendFilter(
+ allocator,
+ &seat.input_manager.server.config.csd_filter,
+ args,
+ );
+}