Skip to content
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

Closed
wants to merge 8 commits into from
Closed

Conversation

Hikari9
Copy link
Owner

@Hikari9 Hikari9 commented Nov 13, 2017

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

  1. Have a fresh clone of this branch:
    git clone https://github.com/Hikari9/comfortable-swipe-ubuntu --branch feature-systemd comfortable-swipe-feature-systemd
    cd comfortable-swipe-feature-systemd
  2. Run
    sudo apt-get install libinput-tools libxdo-dev
    bash install
  3. Check if swiping works:
    • Edit /usr/local/share/comfortable-swipe.conf
    • Configure keyboard mapping to fit your needs (e.g. ctrl+alt+Right for swipe left 3-fingers)
    • Refer to README.md for config list
  4. Reboot and check if swiping still works.
  5. Comment any problems. Please make sure to add the following to your comment:
    • Content of .log (found in the cloned folder)
    • Output of comfortable-swipe status

@Hikari9 Hikari9 mentioned this pull request Nov 13, 2017
@Hikari9 Hikari9 changed the title Use comfortable-swipe as systemd service [WIP] Use comfortable-swipe as systemd service Nov 13, 2017
@Hikari9 Hikari9 changed the title [WIP] Use comfortable-swipe as systemd service Use comfortable-swipe as systemd service Nov 13, 2017
namespace service {
namespace service {
void exec() {
sleep(1);
Copy link
Owner Author

@Hikari9 Hikari9 Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schigum in issue #16

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!

Copy link

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for misunderstanding, @schigum , I thought it was related to this PR, but it seems I was mistaken. Will reopen issue #16

@Hikari9
Copy link
Owner Author

Hikari9 commented Nov 18, 2017

Backlog

Ok, 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:

[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

where $DISPLAY and $XAUTHORITY are environment variables needed by libinput-debug-events. Hope someone who's expert with system services can help me sort this out. Will label this PR with help wanted for starters :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants