Yup, udev is the right tool for this. I'd just put the script in /usr/local/bin, where it belongs.
post
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.
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.
This post is titled badly. Its worded like a question but its actually a blog post that contains the answer. Weird.
Personally? I just open up the laptop and disconnect the keyboard header. Of course, this only works if you only ever use a USB keyboard with the laptop, but thought I'd add it as a valid method.
I used to do this on my touchscreen laptop, key combo to disable and 4 finger swipe to re-enable.
Wrote a small script that used xinput, ran the script as above.
Seems like a silly solution but I just use evtest to disable the keyboard. Did a tiny bash script to disable and re-enable the keyboard by just tracking the pid
no comments (yet)