Skip to content

Commit

Permalink
Disable capslock with udev (#786)
Browse files Browse the repository at this point in the history
* Disable capslock remapper in xremap

* Disable capslock with udev with specifying the device names

* Don't depend on broken services.udev.extraHwdb
  • Loading branch information
kachick authored Sep 15, 2024
1 parent ab4b5e4 commit b3de3ba
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions nixos/hardware.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ ... }:
{
# services.udev = {
# enable = true;
# # Settings keyremap in raw layer than X. See GH-784

# # Specify hardware names even if `evdev:input:*` working for mostcase
# extraHwdb = ''
# evdev:name:Topre REALFORCE 87 US:*
# # original: capslock
# KEYBOARD_KEY_70039=leftctrl
# '';
# };

# Settings keyremap in raw layer than X. See GH-784
# Don't use `services.udev.extraHwdb`, it does not create the file at least in NixOS 24.05
# See https://github.com/NixOS/nixpkgs/issues/182966 for detail
#
# - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout
# - How to get the KEYBOARD_KEY_700??: `showkey --scancodes` in VT
# - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'`
# - How to apply?: After nixos-rebuild switch `sudo systemd-hwdb update && sudo udevadm trigger`
environment.etc."udev/hwdb.d/99-local.hwdb".text = ''
evdev:name:Topre REALFORCE 87 US:*
KEYBOARD_KEY_70039=leftctrl # original: capslock
evdev:name:Lenovo ThinkPad Compact USB Keyboard with TrackPoint:* # Both US and JIS have same name
KEYBOARD_KEY_70039=leftctrl # original: capslock, Both US and JIS have same keycode for capslock
'';
}
1 change: 1 addition & 0 deletions nixos/hosts/algae/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
imports = [
../../configuration.nix
../../gui.nix
../../hardware.nix

./hardware-configuration.nix

Expand Down
1 change: 1 addition & 0 deletions nixos/hosts/moss/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
imports = [
../../configuration.nix
../../gui.nix
../../hardware.nix

./hardware-configuration.nix
./fingerprint.nix
Expand Down
2 changes: 1 addition & 1 deletion nixos/xremap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
name = "Global";
remap = {
"CapsLock" = "Ctrl_L";
# "CapsLock" = "Ctrl_L"; # Avoid using xremap to kill capslock for stability. See GH-784
"Alt_L" = {
"held" = "Alt_L";
"alone" = "Muhenkan";
Expand Down

0 comments on commit b3de3ba

Please sign in to comment.