Skip to content

Commit

Permalink
refactor(nix): extract logiops module
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamHsieh committed Jun 5, 2024
1 parent 63eeff1 commit d08a7b8
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 78 deletions.
82 changes: 4 additions & 78 deletions system/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
{ config, pkgs, ... }:

{
imports =
[
# Include the results of the hardware scan.
./hardware.nix
];
imports = [
./hardware.nix
./logiops.nix
];

boot = {
kernelPackages = pkgs.linuxPackages_zen;
Expand All @@ -20,7 +19,6 @@
};
};


networking.hostName = (import ./config.nix).host;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

Expand Down Expand Up @@ -165,76 +163,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?

systemd.services.logiops = {
description = "An unofficial userspace driver for HID++ Logitech devices";
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.logiops}/bin/logid";
};
};

# NOTE: https://github.com/PixlOne/logiops/blob/main/logid.example.cfg
environment.etc."logid.cfg".text = ''
devices: ({
name: "Wireless Mouse MX Master 3";
smartshift: {
on: true;
threshold: 12;
};
hiresscroll: {
hires: true;
target: false;
};
dpi: 1200;
buttons: ({
cid: 0xc3;
action = {
type: "Gestures";
gestures: ({
direction: "Left";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_F15"];
};
}, {
direction: "Right";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_F16"];
};
}, {
direction: "Down";
mode: "OnRelease";
action = {
type: "Keypress";
keys: ["KEY_F17"];
};
}, {
direction: "Up";
mode: "OnRelease";
action = {
type: "Keypress";
keys: ["KEY_F18"];
};
}, {
direction: "None";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_PLAYPAUSE"];
};
});
};
}, {
cid: 0xc4;
action = {
type: "Keypress";
keys: ["KEY_F19"];
};
});
});
'';
}
75 changes: 75 additions & 0 deletions system/logiops.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{ pkgs, ... }:

{
systemd.services.logiops = {
description = "An unofficial userspace driver for HID++ Logitech devices";
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.logiops}/bin/logid";
};
};

# NOTE: https://github.com/PixlOne/logiops/blob/main/logid.example.cfg
environment.etc."logid.cfg".text = ''
devices: ({
name: "Wireless Mouse MX Master 3";
smartshift: {
on: true;
threshold: 12;
};
hiresscroll: {
hires: true;
target: false;
};
dpi: 1200;
buttons: ({
cid: 0xc3;
action = {
type: "Gestures";
gestures: ({
direction: "Left";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_F15"];
};
}, {
direction: "Right";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_F16"];
};
}, {
direction: "Down";
mode: "OnRelease";
action = {
type: "Keypress";
keys: ["KEY_F17"];
};
}, {
direction: "Up";
mode: "OnRelease";
action = {
type: "Keypress";
keys: ["KEY_F18"];
};
}, {
direction: "None";
mode: "OnRelease";
action = {
type = "Keypress";
keys: ["KEY_PLAYPAUSE"];
};
});
};
}, {
cid: 0xc4;
action = {
type: "Keypress";
keys: ["KEY_F19"];
};
});
});
'';
}

0 comments on commit d08a7b8

Please sign in to comment.