-
Notifications
You must be signed in to change notification settings - Fork 46
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
Use comfortable-swipe as systemd service #15
Conversation
namespace service { | ||
namespace service { | ||
void exec() { | ||
sleep(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks so much for providing this.
It is exactly what I was looking for.I'm running this on Ubuntu 17.10.
One oddity I noticed is that I have a delay of ~1s before the swipe gets executed and the output in >console appears (e.g. SWIPE down 4).
So I (quickly) swipe, take the fingers of the pad and after about 1s it gets executed.
The main question is, is that normal? And can anything be done about that?Thanks and cheers!
Indeed, the cause of this is the sleep(1)
which delays 1 second before executing. This was intended delay for the autostart, but I guess your point makes sense that there's no such need when one just wants to run it normally.
I'm looking for ways to activate it without the delay (using purely dependencies), but I still can't find an appropriate line of code for this to work. If it helps, the current service unit looks like:
[Unit]
Description=Comfortable 3 or 4 finger gestures
After=display-manager.service keyboard-setup.service
[Service]
Environment=DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY
ExecStart=/usr/local/bin/comfortable-swipe exec
Restart=always
RestartSec=2
[Install]
WantedBy=graphical.target
As of now, autostart won't work without the delay, so maybe I'm missing a dependency? I'm not sure. If anyone knows someone who can help out with this, that will be helpful.
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I fully understand.
I'm using the master branch (sorry for not clarifying earlier). So there's no sleep(1) in the cpp file.
Was that introduced to "workaround" the mentioned delay?
To me it sounds like the delay in the code concerns the start of the program. The delay I mentioned happens for the execution of a swipe while the program is running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BacklogOk, so far I'm encountering problems. The autostart as a service is not reliable on my machine (sometimes boots up, on rare times it doesn't). I think this is because there are unmet dependencies in the system units... But unfortunately I don't have any real experience on this so I'm going to backlog this PR for now. (Help Wanted)So far, the service unit I'm using looks like:
where $DISPLAY and $XAUTHORITY are environment variables needed by |
This is intended to address issues #7 and #13.
Summary
This pull request adds
comfortable-swipe
as a systemd service.This is preferred over a local startup application since touchpad gestures are semantically fitting to be called a service. Furthermore, the methods such as start and stop are standard commands usually found in services.
This also bypasses the input device permissions required by
libinput-debug-gestures
, since service daemons would already be handled as a superuser.How to Test
git clone https://github.com/Hikari9/comfortable-swipe-ubuntu --branch feature-systemd comfortable-swipe-feature-systemd cd comfortable-swipe-feature-systemd
/usr/local/share/comfortable-swipe.conf
ctrl+alt+Right
for swipe left 3-fingers).log
(found in the cloned folder)comfortable-swipe status