One of the things which aren’t working out of the box are the “screen brightness” control keys (Fn+F5 & Fn+F6).
On the old Ubuntu system I had set up event handling scripts in i3 for key codes XF86BrightnessUp and XF86BrightnessDown.
But this approach doesn’t work on the P14s / NixOS setup. xev doesn’t report those key codes on key press.
Does anybody has an idea why XF86BrightnessUp and XF86BrightnessDown aren’t recognised by xev?
Any packages, drivers, kernel options that I’m missing?
I found a solution that I was able to adapt on NixOS. In my eyes as a newbie this looks a bit ugly / hackish.
Any suggestions to improve this nix-code?
I’m using your hardware.nix. But unfortunately XF86BrightnessUp and XF86BrightnessDown keycodes are not recognised. nix-shell -p xorg.xev --run "xev -event keyboard" | grep XF86 only report keycode 151 (= FN key is pressed)
ls /sys/class/backlight/ prints amdgpu_bl0.
dmesg output is available here:
some interesting findings are [ 0.303902] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[ 7.974158] thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness control, supported by the ACPI video driver
[ 7.974159] thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
[ 8.115285] thinkpad_acpi: Standard ACPI backlight interface available, not loading native one
Sorry for my misleading issue description. The nix solution I wrote in the first post is actually working fine.
But I have to use that ugly acpid-hack instead of trigger XF86BrightnessUp key events.
The Problem with the acpid soltuion is, that it isn’t very portable.
Now I’ve to maintain two different approaches for backlight control in my multi machine nixos-config collection. The acpid one for the Lenovo P14s Gen 2, and XF86BrightnessUp in the i3 config for my Lenovo X230.