cross-posted from: https://feddit.nl/post/49130941
How to disable Linux laptop keyboard when custom keyboard is plugged in
How are you guys doing this? Are you using Sway or Hyprland for this? Anyone else using udev already?
This post is titled badly. Its worded like a question but its actually a blog post that contains the answer. Weird.
It’s perfectly titled. “How to” is a statement, a question is “how do I…?”
I assume one of the reasons to fully disable the internal keyboard is that the external one is sitting on top, so this setup is for when you are short of space? (eg.: lap carrying your laptop, note: don’t do that!)
Tho, someone correct me if this is not the case, this way, ¿you would also lose access to the special hardware key functions of the keyboard (eg.: AURA mode, fan speed, rfkill on ASUS laptops, etc), right?
Defo this is one of the nice thigns I like udev rules for - taking action when specific hardware is plugged or unplugged, thus making the mechanical task of connecting and configuring hardware lots more ergonomic.
My ASUS laptop special buttons above the normal keyboard are registered as a separate device to the kernel, so this does not impact them. They are far enough out of the way to not get pressed by my ergo split though.
Excellent! Hadn’t really thought that one keyboard can be multiple devices, but then again, those are also keyboard-touchpad combos, should have expected something like that.
I have never plugged a keyboard into my Linux laptop, but it does have a function key to turn the keyboard off. So did my last one. I use a windows laptop for work and that keyboard does not turn off when an external keyboard is plugged in FWIW.
My laptop didn’t have a key for that, so I ended up gluing together this universal Linux solution.
Yup, udev is the right tool for this. I’d just put the script in
/usr/local/bin, where it belongs.



