bulletmark / libinput-gestures

Actions gestures on your touchpad using libinput
3.93k stars 241 forks source link

what to do when you are calling libinput-gestures from a KDE menu / autostart script / keyboard shortcut #284

Closed nlambert closed 3 years ago

nlambert commented 3 years ago

I've been enjoying libinput-gestures for the past few months. Works perfect... until :-0

Just kidding, it works perfect but something is happening and I can't wrap my head around it.

On login (kde) an autostart script runs libinput-gestures-setup restart.

The first 2 gestures are working fine and the rest are not, until I run libinput-gestures-setup restart and then they do.

I ran libinput-gestures -d before and after. See terminal output below.

I have a notify-send command in my gesture-action script. It starts notifying only after I type libinput-gestures-setup restart in the terminal.

It's as if libinput-gestures is telling me it has the right config loaded when it doesn't. It seems like it has default configuration from somewhere else and is lying about it! That rascal.

Any help appreciated :-)

❯ libinput-gestures -d
libinput-gestures: session plasma+tty on Linux-5.9.10-arch1-1-x86_64-with-glibc2.2.5, python 3.8.6, libinput 1.16.3
/usr/bin/libinput-gestures: hash 0344acdbe1ec2e111b60830e2839cce5
Gestures configured in ~/.config/libinput-gestures.conf:
swipe right_up   4 _internal ws_up
swipe left_up    4 _internal ws_down
swipe up         4 gesture-action maximize
swipe down       4 gesture-action close_window
swipe left       4 gesture-action tile_left
swipe right      4 gesture-action tile_right
swipe up         3 gesture-action minimize
swipe down       3 gesture-action close_tab
swipe left       3 gesture-action forward
swipe right      3 gesture-action back
swipe right_up   3 gesture-action cycle_all_windows
swipe right_down 3 gesture-action cycle_app_windows
swipe left_up    3 gesture-action show_all_windows
swipe left_down  3 gesture-action show_all_desktops
libinput-gestures: device /dev/input/event21: Apple Inc. Magic Trackpad 2
libinput-gestures is already running for nlambert, terminating ..
❯ libinput-gestures-setup restart
libinput-debug-events stopped.
libinput-gestures stopped.
libinput-gestures started.
❯ libinput-gestures -d
libinput-gestures: session plasma+tty on Linux-5.9.10-arch1-1-x86_64-with-glibc2.2.5, python 3.8.6, libinput 1.16.3
/usr/bin/libinput-gestures: hash 0344acdbe1ec2e111b60830e2839cce5
Gestures configured in ~/.config/libinput-gestures.conf:
swipe right_up   4 _internal ws_up
swipe left_up    4 _internal ws_down
swipe up         4 gesture-action maximize
swipe down       4 gesture-action close_window
swipe left       4 gesture-action tile_left
swipe right      4 gesture-action tile_right
swipe up         3 gesture-action minimize
swipe down       3 gesture-action close_tab
swipe left       3 gesture-action forward
swipe right      3 gesture-action back
swipe right_up   3 gesture-action cycle_all_windows
swipe right_down 3 gesture-action cycle_app_windows
swipe left_up    3 gesture-action show_all_windows
swipe left_down  3 gesture-action show_all_desktops
libinput-gestures: device /dev/input/event21: Apple Inc. Magic Trackpad 2
libinput-gestures is already running for nlambert, terminating ..
bulletmark commented 3 years ago

I don't understand how you got to that conclusion? Almost certainly the bug is in your own gesture-action script. It is assuming something about your environment which is true when you start it from the command line, but is not true when started by KDE. Put some temp debug in that script (e.g. write to a log file in /tmp/gesture-action.log) to work the bug out. Where is that script located? Possibly a $PATH issue so I'd start by fully specifying that path in the conf file to make sure it is actually found.

bulletmark commented 3 years ago

Also, please edit the issue title to something more appropriate.

nlambert commented 3 years ago

Hey Mark, thanks for the reply! I came to that conclusion thanks to the notify-send that I have at the top of the script. Equivalent to writing to a log file. Before running libinput-gestures-setup restart nothing is being written/notified. After running libinput-gestures-setup restart notifications are appearing. The gesture-action script isn't being called before reloading the configuration.

nlambert commented 3 years ago

Good things those first commands where used as is. It actually helped to figure out what was happening.

bulletmark commented 3 years ago

I already pointed out why your script is probably not running. It is because you have not specified the full path in your configuration. Fix that!

I don't understand why you still think the wrong configuration file is being used? The title should not be about "lying about loaded config" or "not reporting correct config" because the bug is in your configuration, not libinput-gestures which is always correctly using your ~/.config/libinput-gestures.conf file. So please correct the title to something relevant to the problem, e.g. commands are not working until I restart the application, etc.

nlambert commented 3 years ago

I was just about to write... I added keyboard shortcuts to see what would happen and it was giving the same results. You're absolutely right about the $PATH when KDE is launching the script. Apologies about the title. I was feeling playful and spontaneous. Full path in ~/.config/libinput-gestures.conf solves the issue.

nlambert commented 3 years ago

I really appreciate the back and forth. Both libinput-gestures and dbus-action together are fabulous and make using a trackpad on linux a truly enjoyable experience.