touchcursor-linux icon indicating copy to clipboard operation
touchcursor-linux copied to clipboard

Service stops when keyboard is unplugged

Open yarcod opened this issue 2 years ago • 4 comments

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!

yarcod avatar Aug 17 '22 12:08 yarcod

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.

Adda0 avatar Aug 17 '22 13:08 Adda0

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 avatar Aug 18 '22 06:08 yarcod

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.

yarcod avatar Aug 18 '22 07:08 yarcod

@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

1999shaswat avatar Feb 23 '23 13:02 1999shaswat