control: implement set-repeat

This commit is contained in:
Bonicgamer 2020-11-18 09:28:33 -05:00 committed by GitHub
parent 1626203c44
commit cbd4a2807b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 0 deletions

View File

@ -128,6 +128,9 @@ do
riverctl map "${mode}" None XF86MonBrightnessDown spawn light -U 5
done
# Set repeat rate
riverctl set-repeat 50 300
# Set the layout on startup
riverctl layout rivertile left

View File

@ -196,6 +196,10 @@ that tag 1 through 9 are visible.
*outer-padding* _pixels_
Set the padding around the edge of the screen to _pixels_.
*set-repeat* _rate_ _delay_
Set the keyboard repeat rate to _rate_ key repeats per second and
repeat delay to _delay_ milliseconds.
*unmap* [-release] _mode_ _modifiers_ _key_
Removes the mapping defined by the arguments *-release*, *modifiers* and *key* from *mode*.
See *map* for an explanation of the arguments.

View File

@ -67,6 +67,7 @@ const str_to_impl_fn = [_]struct {
.{ .name = "resize", .impl = @import("command/move.zig").resize },
.{ .name = "send-to-output", .impl = @import("command/send_to_output.zig").sendToOutput },
.{ .name = "set-focused-tags", .impl = @import("command/tags.zig").setFocusedTags },
.{ .name = "set-repeat", .impl = @import("command/set_repeat.zig").setRepeat },
.{ .name = "set-view-tags", .impl = @import("command/tags.zig").setViewTags },
.{ .name = "snap", .impl = @import("command/move.zig").snap },
.{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },

View File

@ -0,0 +1,42 @@
// This file is part of river, a dynamic tiling wayland compositor.
//
// Copyright 2020 The River Developers
//
// 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 c = @import("../c.zig");
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
/// Set the repeat rate and delay for all keyboards.
pub fn setRepeat(
allocator: *std.mem.Allocator,
seat: *Seat,
args: []const []const u8,
out: *?[]const u8,
) Error!void {
if (args.len < 3) return Error.NotEnoughArguments;
if (args.len > 3) return Error.TooManyArguments;
const rate = try std.fmt.parseInt(i32, args[1], 10);
const delay = try std.fmt.parseInt(i32, args[2], 10);
var it = seat.keyboards.first;
while (it) |node| : (it = node.next) {
c.wlr_keyboard_set_repeat_info(node.data.wlr_keyboard, rate, delay);
}
}