Posts

Showing posts from September, 2019

Disabling internal keyboard using udev

These scripts will disable internal keyboard automatically when mechanical keyboard connected. My keyboard is Keychron K2   . I'm using gnome shell under Wayland, Fedora 30 First, create two script which will run on device add and remove $ vi /path/key_grab.sh #!/bin/sh wall "Grabbing keyboard" /usr/bin/killall evtest echo "/usr/bin/evtest --grab /dev/input/event2 > /dev/null" | at now $ vi /path/key_grab_end.sh #!/bin/sh wall "Ungrab keyboard" /usr/bin/killall evtest Then edit udev rule in /etc/udev/rules.d/99-my.rules ACTION=="add", SUBSYSTEM=="hid", ENV{HID_NAME}=="Keychron K2", RUN+=" /path/key_grab.sh " ACTION=="remove", SUBSYSTEM=="hid", ENV{HID_NAME}=="Keychron K2", RUN+=" /path/key_grab_end.sh " Reload udev rules: $ udevadm control --reload-rules && udevadm trigger Finally, try to plug unplug USB Cable or connect/disconnect Blueto

Keychron K2 in Linux

Image
OK... I got new mechanical keyboard: Keychron K2 😀 Nice and compact keyboard layout with F-Keys and cursor keys. Brown switch and RGB Led and big battery It works nicely under Linux, I use gnome-shell, Fedora 30. Using USB cable or Bluetooth is also working. Key combo like Ctrl-Shift-PrintScreen is working and also trigger SysRq like Ctrl-Shift-Alt-PrintScreen-O is working (don't try this) To make Function keys without pressing Fn use this command: echo 2 > /sys/module/hid_apple/parameters/fnmode Ref: https://imgur.com/y3j6pUG To make it permanent, edit /etc/modprobe.d/keychron.conf and reboot: options hid-apple fnmode=2 We can also see remaining battery from Gnome Settings - Power