-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run as service via systemd #76
Comments
This lines up with what I had created on my own end for a user daemon unit. Do we also want to consider the option of a system daemon unit, which would require both a global config path (/etc/lan-mouse/config.toml) and dedicated daemon user (lanmouse)? I have a specific use case that will require either enabling lingering on my user session on one of my systems, or running the service under the system daemon. Using session lingering isn't a terrible solution, but it isn't obvious to less-experienced Linux users that lingering is even an option. |
A system service will not work because lan-mouse does not wait for a session to come online and simply falls back to the dummy backend. I would need to implement a way to wait for a session first. (Using systemd?) I have been thinking about how that could be done but it will definitely take some effort. Maybe something similar to how rkvm works. |
Upon further review, I have an additional thought: Is there a reason you used "network-pre.target " rather than simply "network.target"? I think it would be better to avoid tying service ordering to specific network management services, as that can potentially lead to issues for users of other network daemons (e.g. netctl in my case). If it's a startup delay concern, I don't think ordering against network.target would drastically increase startup times, at least not as much as network-online.target. |
Network should actually not be necessary at all, as lan-mouse is connection less and simply starts working as soon as a network is connected. It should however be ensured that a graphical session is running. I'm guessing |
Same goes for DNS. We probably should not assume that systemd-resolved is used either way. |
All good reasoning. Makes sense to exclude all the Wants/After. It was mostly there based on the example I was using. |
It should now be possible to automate everything. Tell me if you notice any bugs :) And also feel free to open a PR for the user service. |
Great news! I'll give it a go this evening. Have you thought about adding a daemon option to the GUI and/or a tray icon? |
My latest commit broke it again. Have to fix asap |
fixed |
I initially had a (non functional) switch as a mockup and removed that. Technically I could add that back but that would break the "normal" way of running lan-mouse where the service is started as a child process and terminated when the gui exits. I also want to eventually implement the service functionality with the background / autostart portal which is probably more userfriendly, would work with flatkap and also would not require a toggle. As for the system tray: I have not thought about it yet. I will add it to my list. |
[Unit]
Description=Mouse & keyboard sharing via LAN
After=graphical-session.target
[Service]
ExecStart=/usr/bin/lan-mouse --daemon
Restart=on-failure
[Install]
WantedBy=graphical-session.target Did some testing my self. The above seems to work for me. |
There was one final bug that prevented it from working (forgot to do an initial dns request ...) |
Works perfectly for me with the Much appreciated! |
If you want, you could update the AUR packages @CupricReki |
So I'm thinking, install the systemd unit but don't enable it. |
Yeah, it should not be enabled by default. Especially since the Input Capture / Emulation popups show up every restart on e.g. Gnome Desktop. |
Here is an example service file. Connection still needs to be activated via GUI until #70 is sorted.
Start now and on boot
The text was updated successfully, but these errors were encountered: