evremap
evremap copied to clipboard
evremap (systemd service) does not start if the device its trying to remap is not connected
So, I have a TV remote, which is connected over a USB 2.4GHz dongle, and the remote does not have some important keys such as Shift, Control, Alt, Tab and Meta. So I use evremap to map these keys to the keys that are on the remote. The remote is plugged into the dock for my laptop - meaning, its only connected to my laptop when I am home. However, a laptop is still, very obviously, a laptop, so its not out of ordinary for it to be turned on when i am on the go - like, on a lecture in the university or something. And if the laptop is turned on elsewhere and then I get back home, the mappings do not work, because at the time of startup evremap's systemd service did not see the remote's usb dongle and emulated input devices plugged in.
This can happen with any scenario when any laptop is connected to an input device, but not permanently: people who use their Thinkpads as workstations when they are home (like me), people who sometimes connect a USB keyboard for some couch gaming, people who try to use evremap with bluetooth input methods and their bluetooth input method just ran out of battery or wasn't on when their computer was starting, etc.
There should be some built in way to wait for the needed device to connect, IMHO. For a convenience tool that evremap is, making it more convenient is only better, right?
you can write an udev rule to start the service on keyboard connect