1 { config, lib, pkgs, ... }:
4 cfg = config.services.xserver.imwheel;
8 services.xserver.imwheel = {
9 enable = mkEnableOption "IMWheel service";
11 extraOptions = mkOption {
12 type = types.listOf types.str;
13 default = [ "--buttons=45" ];
14 example = [ "--debug" ];
16 Additional command-line arguments to pass to
22 type = types.attrsOf types.str;
24 example = literalExpression ''
28 None, Down, Button5, 8
29 Shift_L, Up, Shift_L|Button4, 4
30 Shift_L, Down, Shift_L|Button5, 4
31 Control_L, Up, Control_L|Button4
32 Control_L, Down, Control_L|Button5
37 Window class translation rules.
38 /etc/X11/imwheelrc is generated based on this config
39 which means this config is global for all users.
40 See [official man pages](https://imwheel.sourceforge.net/imwheel.1.html)
47 config = mkIf cfg.enable {
48 environment.systemPackages = [ pkgs.imwheel ];
50 environment.etc."X11/imwheel/imwheelrc".source =
51 pkgs.writeText "imwheelrc" (concatStringsSep "\n\n"
53 (rule: conf: "\"${rule}\"\n${conf}") cfg.rules
56 systemd.user.services.imwheel = {
57 description = "imwheel service";
58 wantedBy = [ "graphical-session.target" ];
59 partOf = [ "graphical-session.target" ];
61 ExecStart = "${pkgs.imwheel}/bin/imwheel " + escapeShellArgs ([
64 ] ++ cfg.extraOptions);
65 ExecStop = "${pkgs.procps}/bin/pkill imwheel";