Skip to content

Commit

Permalink
guivm: Passthrough the multimedia keys
Browse files Browse the repository at this point in the history
Thinkpad multimedia function keys have a different input device.

Signed-off-by: Berk Arslan <berk.arslan@unikie.com>
  • Loading branch information
Nerox9 committed May 8, 2024
1 parent c46113e commit fccebca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/common/hardware/lenovo-x1/definitions/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ in {
in ''
# 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
Expand All @@ -44,6 +46,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)
Expand Down
13 changes: 12 additions & 1 deletion modules/desktop/graphics/labwc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@
</font>
</theme>
<keyboard>
<default />
${lib.optionalString config.ghaf.profiles.debug.enable ''
<keybind key="Print">
<action name="Execute" command="${pkgs.grim}/bin/grim" />
</keybind>
''}
<default />
<keybind key="XF86_MonBrightnessUp">
<action name="Execute" command="${pkgs.brightnessctl}/bin/brightnessctl set +10%" />
</keybind>
<keybind key="XF86_MonBrightnessDown">
<action name="Execute" command="${pkgs.brightnessctl}/bin/brightnessctl set 10%-" />
</keybind>
</keyboard>
<mouse><default /></mouse>
<windowRules>
Expand Down Expand Up @@ -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"
'';
};
}
1 change: 1 addition & 0 deletions targets/lenovo-x1/everything.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"iommu=pt"
# Prevent i915 module from being accidentally used by host
"module_blacklist=i915"
"acpi_backlight=vendor"

"vfio-pci.ids=${builtins.concatStringsSep "," vfioPciIds}"
];
Expand Down
2 changes: 1 addition & 1 deletion targets/lenovo-x1/guivmExtraModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
};
};
};

# Open TCP port for the PDF XDG socket
networking.firewall.allowedTCPPorts = [xdgPdfPort];
# Early KMS needed for GNOME to work inside GuiVM
Expand Down

0 comments on commit fccebca

Please sign in to comment.