Skip to content

Commit

Permalink
mouse-actions: init at 0.4.4
Browse files Browse the repository at this point in the history
Co-authored-by: Donovan Glover <[email protected]>
Co-authored-by: Arne Keller <[email protected]>
  • Loading branch information
3 people committed Jan 26, 2024
1 parent 4d71fcc commit 28614f6
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
./programs/minipro.nix
./programs/miriway.nix
./programs/mosh.nix
./programs/mouse-actions.nix
./programs/msmtp.nix
./programs/mtr.nix
./programs/nano.nix
Expand Down
15 changes: 15 additions & 0 deletions nixos/modules/programs/mouse-actions.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:

let
cfg = config.programs.mouse-actions;
in
{
options.programs.mouse-actions = {
enable = lib.mkEnableOption ''
mouse-actions udev rules. This is a prerequisite for using mouse-actions without being root.
'';
};
config = lib.mkIf cfg.enable {
services.udev.packages = [ pkgs.mouse-actions ];
};
}
49 changes: 49 additions & 0 deletions pkgs/by-name/mo/mouse-actions/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, libX11
, libXi
, libXtst
, libevdev
}:

rustPlatform.buildRustPackage rec {
pname = "mouse-actions";
version = "0.4.4";

src = fetchFromGitHub {
owner = "jersou";
repo = "mouse-actions";
rev = "v${version}";
hash = "sha256-02E4HrKIoBV3qZPVH6Tjz9Bv/mh5C8amO1Ilmd+YO5g=";
};

cargoHash = "sha256-5SUVZlrXIPtlu9KBzucZDCp5t5t8Z4/Nfht2Pw5agVI=";

buildInputs = [
libX11
libXi
libXtst
libevdev
];

nativeBuildInputs = [
pkg-config
];

postInstall = ''
mkdir -p $out/etc/udev/rules.d/
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess", OPTIONS+="static_node=uinput"' >> $out/etc/udev/rules.d/80-mouse-actions.rules
echo 'KERNEL=="/dev/input/event*", SUBSYSTEM=="misc", TAG+="uaccess", OPTIONS+="static_node=uinput"' >> $out/etc/udev/rules.d/80-mouse-actions.rules
'';

meta = with lib; {
description = "Execute commands from mouse events such as clicks/wheel on the side/corners of the screen, or drawing shapes";
homepage = "https://github.com/jersou/mouse-actions";
license = licenses.mit;
maintainers = with maintainers; [ rgri ];
mainProgram = "mouse-actions";
platforms = platforms.linux;
};
}

0 comments on commit 28614f6

Please sign in to comment.