From 35a5e3f120ac2c2810477920a8c645a2e743da9b Mon Sep 17 00:00:00 2001 From: Berk Arslan Date: Thu, 2 May 2024 15:20:44 +0300 Subject: [PATCH] guivm: Passthrough the multimedia keys to set brightness Thinkpad multimedia function keys have a different input device. ACPI backlight option should be overridden as vendor in kernel to use the all function keys in the same input. Signed-off-by: Berk Arslan --- modules/desktop/graphics/labwc.nix | 13 ++++++++++++- modules/hardware/lenovo-x1/definitions/default.nix | 3 +++ targets/lenovo-x1/everything.nix | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/desktop/graphics/labwc.nix b/modules/desktop/graphics/labwc.nix index 79998945d..9fa62fdc5 100644 --- a/modules/desktop/graphics/labwc.nix +++ b/modules/desktop/graphics/labwc.nix @@ -60,12 +60,18 @@ + ${lib.optionalString config.ghaf.profiles.debug.enable '' ''} - + + + + + + @@ -288,5 +294,10 @@ in { }; wantedBy = ["default.target"]; }; + + #Allow video group to change brightness + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video $sys$devpath/brightness", RUN+="${pkgs.coreutils}/bin/chmod a+w $sys$devpath/brightness" + ''; }; } diff --git a/modules/hardware/lenovo-x1/definitions/default.nix b/modules/hardware/lenovo-x1/definitions/default.nix index 9fbea6e6c..9437accf6 100644 --- a/modules/hardware/lenovo-x1/definitions/default.nix +++ b/modules/hardware/lenovo-x1/definitions/default.nix @@ -29,6 +29,7 @@ in { virtioInputHostEvdevs = [ # Lenovo X1 touchpad and keyboard "/dev/input/by-path/platform-i8042-serio-0-event-kbd" + "/dev/input/by-path/platform-thinkpad_acpi-event" "/dev/mouse" "/dev/touchpad" # Lenovo X1 trackpoint (red button/joystick) @@ -48,6 +49,8 @@ in { services.udev.extraRules = '' # Laptop keyboard SUBSYSTEM=="input", ATTRS{name}=="AT Translated Set 2 keyboard", GROUP="kvm" + # Laptop keyboard multimedia buttons + SUBSYSTEM=="input", ATTRS{name}=="ThinkPad Extra Buttons", GROUP="kvm" # Laptop TrackPoint SUBSYSTEM=="input", ATTRS{name}=="TPPS/2 Elan TrackPoint", GROUP="kvm" # Lenovo X1 integrated webcam diff --git a/targets/lenovo-x1/everything.nix b/targets/lenovo-x1/everything.nix index 38cb7de87..7323c5b20 100644 --- a/targets/lenovo-x1/everything.nix +++ b/targets/lenovo-x1/everything.nix @@ -139,6 +139,7 @@ "iommu=pt" # Prevent i915 module from being accidentally used by host "module_blacklist=i915" + "acpi_backlight=vendor" "vfio-pci.ids=${builtins.concatStringsSep "," vfioPciIds}" ];