donniebreve / touchcursor-linux

TouchCursor style keyboard remapping for Linux.
GNU General Public License v2.0
133 stars 28 forks source link

Service stops when keyboard is unplugged #51

Open yarcod opened 2 years ago

yarcod commented 2 years ago

Hi!

First of all, thanks for a great application! It makes it feasible to use a 60% keyboard on Linux and it is awesome! And, dare I say, it works even better in Linux than Martin Stone's version for Windows does -- good job!

I have run into an issue, however. My keyboard is plugged into my docking station, so whenever I disconnect the laptop from it the keyboard disappears and the application stops. I can see in the source code that this is by design. However, I was wondering if the application could be extended somewhat to (optionally) create a udev rule for the configured keyboard and then let the systemd service depend on that. Or, another way would to simply let a udev rule start the service when the keyboard is connected. Would this be of interest to add?

Thanks again!

Adda0 commented 2 years ago

Hello, we are glad you find this application useful.

Exactly as you say, the described behaviour is intended, at least for now.

Automatic restarts of the service are something we have discussed already. Feel free to read through #12 where we discussed this for a bit. It would definitely be a nice feature to have. I think that your general idea is feasible and probably the way to go. The implementation details are to be resolved.

I am currently working on my C++ port of touchcursor-linux, but when someone can spare some free time, it would make for a great addition, for sure.

Have a nice day.

yarcod commented 2 years ago

Would it be an okay solution to use systemd.path to just monitor /dev/input for newly attached devices, and if the specified keyboard is not present then just exit the application again? From what I can see in this post this would only require an additional .path file for the service to rely on. I'm not sure, however, if this is possible under the user scope.

yarcod commented 2 years ago

I created https://github.com/donniebreve/touchcursor-linux/pull/52 as an initial attempt. It works locally for me, plugging the keyboard in and out several times. Also re-attaching the dock, with multiple (input) devices attached, works.

1999shaswat commented 1 year ago

@yarcod For now, I'm trying to restart touchcursor service via udev rules on bluetooth keyboard connection. But I'm not able to do so. Can we connect on discord or somewhere else? Or can you guide me on how to do it properly? Thanks