control: implement set-repeat
This commit is contained in:
parent
1626203c44
commit
cbd4a2807b
4 changed files with 50 additions and 0 deletions
|
@ -128,6 +128,9 @@ do
|
||||||
riverctl map "${mode}" None XF86MonBrightnessDown spawn light -U 5
|
riverctl map "${mode}" None XF86MonBrightnessDown spawn light -U 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Set repeat rate
|
||||||
|
riverctl set-repeat 50 300
|
||||||
|
|
||||||
# Set the layout on startup
|
# Set the layout on startup
|
||||||
riverctl layout rivertile left
|
riverctl layout rivertile left
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,10 @@ that tag 1 through 9 are visible.
|
||||||
*outer-padding* _pixels_
|
*outer-padding* _pixels_
|
||||||
Set the padding around the edge of the screen to _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_
|
*unmap* [-release] _mode_ _modifiers_ _key_
|
||||||
Removes the mapping defined by the arguments *-release*, *modifiers* and *key* from *mode*.
|
Removes the mapping defined by the arguments *-release*, *modifiers* and *key* from *mode*.
|
||||||
See *map* for an explanation of the arguments.
|
See *map* for an explanation of the arguments.
|
||||||
|
|
|
@ -67,6 +67,7 @@ const str_to_impl_fn = [_]struct {
|
||||||
.{ .name = "resize", .impl = @import("command/move.zig").resize },
|
.{ .name = "resize", .impl = @import("command/move.zig").resize },
|
||||||
.{ .name = "send-to-output", .impl = @import("command/send_to_output.zig").sendToOutput },
|
.{ .name = "send-to-output", .impl = @import("command/send_to_output.zig").sendToOutput },
|
||||||
.{ .name = "set-focused-tags", .impl = @import("command/tags.zig").setFocusedTags },
|
.{ .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 = "set-view-tags", .impl = @import("command/tags.zig").setViewTags },
|
||||||
.{ .name = "snap", .impl = @import("command/move.zig").snap },
|
.{ .name = "snap", .impl = @import("command/move.zig").snap },
|
||||||
.{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },
|
.{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },
|
||||||
|
|
42
river/command/set_repeat.zig
Normal file
42
river/command/set_repeat.zig
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue