Skip to content

Commit 2d0fd3c

Browse files
author
johanw
committed
Merge version for multiple command executions with master branch
2 parents 2294393 + 1ae7339 commit 2d0fd3c

10 files changed

+646
-115
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
ignore = E126,E127,E128,E302,E305,E401
33
max-line-length = 80
4-
max-complexity = 30
4+
max-complexity = 36

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ uninstall:
2929
check:
3030
flake8 libinput-gestures internal internal-test
3131
shellcheck $(SHELLCHECK_OPTS) libinput-gestures-setup list-version-hashes
32-
vermin -i -q -t 3.4 --no-tips libinput-gestures
32+
vermin -i -q -t 3.5 --no-tips libinput-gestures
3333
vermin -i -q --no-tips internal internal-test
3434

3535
doc: $(DOCOUT)

README.md

Lines changed: 102 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,36 @@ https://github.com/bulletmark/libinput-gestures.
2929

3030
### INSTALLATION
3131

32-
IMPORTANT: You must be a member of the _input_ group to have permission
32+
You need python 3.5 or later, python2 is not supported. You also need
33+
libinput release 1.0 or later.
34+
35+
You **must be a member of the _input_ group** to have permission
3336
to read the touchpad device:
3437

3538
sudo gpasswd -a $USER input
3639

37-
After executing the above command, **log out of your session
38-
completely**, and then log back in to assign this group (or just
39-
reboot).
40+
After executing the above command, reboot your system.
4041

41-
NOTE: Arch users can just install [_libinput-gestures from the
42-
AUR_][AUR]. Then skip to the next CONFIGURATION section.
42+
Most/many users will require to install the following although neither are
43+
actual dependencies because some custom configurations will not require
44+
them. If you are unsure initially, install both of them.
4345

44-
You need python 3.4 or later, python2 is not supported. You also need
45-
libinput release 1.0 or later. Install prerequisites:
46+
|Prerequisite|Required for |
47+
|------------|-------------|
48+
|`wmctrl` |Necessary for `_internal` command, as per default configuration|
49+
|`xdotool` |Simulates keyboard and mouse actions for Xorg or XWayland based apps|
4650

4751
# E.g. On Arch:
48-
sudo pacman -S xdotool wmctrl
52+
sudo pacman -S wmctrl xdotool
4953

5054
# E.g. On Debian based systems, e.g. Ubuntu:
51-
sudo apt-get install xdotool wmctrl
55+
sudo apt-get install wmctrl xdotool
5256

5357
# E.g. On Fedora:
54-
sudo dnf install xdotool wmctrl
58+
sudo dnf install wmctrl xdotool
59+
60+
NOTE: Arch users can now just install [_libinput-gestures from the
61+
AUR_][AUR]. Then skip to the next CONFIGURATION section.
5562

5663
Debian and Ubuntu users may also need to install `libinput-tools` if
5764
that package exists in your release:
@@ -147,33 +154,63 @@ if needed. If you have multiple touchpads you can also specify
147154

148155
### STARTING AND STOPPING
149156

150-
Search for, and then start, the `libinput-gestures` app in your DE or
151-
you can start it immediately in the background using the command line
152-
utility:
157+
You must choose between starting the application as a [systemd user
158+
service](https://wiki.archlinux.org/index.php/Systemd/User), or as a
159+
[desktop
160+
application](https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html)
161+
(with an XDG compliant DE such as GNOME and KDE). The systemd user service
162+
option for `libinput-gestures` was added in Feb 2021 and provides more
163+
robust management and better logging than the desktop so is now the preferred choice.
164+
Choose one of the two following options:
153165

154-
libinput-gestures-setup start
166+
1. To set up the application as a [systemd user
167+
service](https://wiki.archlinux.org/index.php/Systemd/User):
155168

156-
You can stop the background app with:
169+
````
170+
libinput-gestures-setup service
171+
````
157172

158-
libinput-gestures-setup stop
173+
2. Or instead, to set up the application using your
174+
[DE](https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html):
175+
176+
````
177+
libinput-gestures-setup desktop
178+
````
179+
180+
After *choosing one of the above*, you can use then run the following commands:
159181

160-
You can enable the app to start automatically in the background when you
161-
log in (on an XDG compliant DE such as GNOME and KDE) with:
182+
Enable the app to start automatically in the background when you
183+
log in with:
162184

163185
libinput-gestures-setup autostart
164186

165-
You can disable the app from starting automatically with:
187+
Disable the app from starting automatically with:
166188

167189
libinput-gestures-setup autostop
168190

169-
You can restart the app or reload the configuration file with:
191+
Start the app immediately in the background:
192+
193+
libinput-gestures-setup start
194+
195+
Stop the background app immediately with:
196+
197+
libinput-gestures-setup stop
198+
199+
Restart the app, e.g. to reload the configuration file, with:
170200

171201
libinput-gestures-setup restart
172202

173-
You can check the status of the app with:
203+
Check the status of the app with:
174204

175205
libinput-gestures-setup status
176206

207+
Note if you are starting using the DE option and you are using some
208+
uncommon systems then `libinput-gestures-setup start` may fail
209+
to start the application returning you a message _Don't know how to
210+
invoke libinput-gestures.desktop_. If you get this error message,
211+
install the dex package, preferably from your system packages
212+
repository, and try again.
213+
177214
### UPGRADE
178215

179216
# cd to source dir, as above
@@ -189,21 +226,21 @@ You can check the status of the app with:
189226

190227
### WAYLAND AND OTHER NOTES
191228

192-
This utility exploits `xdotool` which unfortunately only works with
193-
X11/Xorg based applications. So `xdotool` shortcuts for the desktop do
194-
not work under GNOME on Wayland which is the default since GNOME
195-
3.22. However, it is found that `wmctrl` desktop selection commands do work
196-
under GNOME on Wayland (via XWayland) so this utility adds a built-in
197-
`_internal` command which can be used to switch workspaces using the
198-
swipe commands.
199-
The `_internal` `ws_up` and `ws_down` commands use `wmctrl` to work out
200-
the current workspace and select the next one. Since this works on both
201-
Wayland and Xorg, and with GNOME, KDE, and other EWMH compliant
202-
desktops, it is the default configuration command for swipe up and
203-
down commands in `libinput-gestures.conf`. See the comments in that file
204-
about other options you can do with the `_internal` command.
205-
Unfortunately `_internal` does not work with Compiz for Ubuntu
206-
Unity desktop so also see the explicit example there for Unity.
229+
This utility exploits `xdotool` for many use cases which unfortunately
230+
only works with X11/Xorg based applications. So `xdotool` shortcuts for
231+
the desktop do not work under GNOME on Wayland which is the default
232+
since GNOME 3.22. However, it is found that `wmctrl` desktop selection
233+
commands do work under GNOME on Wayland (via XWayland) so this utility
234+
adds a built-in `_internal` command which can be used to switch
235+
workspaces using the swipe commands. The `_internal` `ws_up` and
236+
`ws_down` commands use `wmctrl` to work out the current workspace and
237+
select the next one. Since this works on both Wayland and Xorg, and with
238+
GNOME, KDE, and other EWMH compliant desktops, it is the default
239+
configuration command for swipe up and down commands in
240+
`libinput-gestures.conf`. See the comments in that file about other
241+
options you can do with the `_internal` command. Unfortunately
242+
`_internal` does not work with Compiz for Ubuntu Unity desktop so also
243+
see the explicit example there for Unity.
207244

208245
Of course, `xdotool` commands do work via XWayland for Xorg based apps
209246
so, for example, page forward/back swipe gestures do work for Firefox
@@ -244,6 +281,23 @@ give a total of 8 swipe gestures each at 45 degrees separation. It works
244281
better than you may expect, at least after some practice. It means you
245282
can completely manage browser tabs from your touchpad.
246283

284+
### AUTOMATIC STOP/RESTART ON D-BUS EVENTS SUCH AS SUSPEND
285+
286+
There are some situations where you may want to automatically stop,
287+
start, or restart `libinput-gestures`. E.g. some touchpads have a
288+
problem which causes `libinput-gestures` (actually the underlying
289+
`libinput debug-events`) to hang after resuming from a system suspend so
290+
those users want to stop `libinput-gestures` when a system goes into
291+
suspend and then start it again with resuming. You can use a companion
292+
program [`dbus-action`][DBUS] to
293+
do this. See the example configuration for `libinput-gestures` in the
294+
default [`dbus-action`][DBUS] [configuration
295+
file](https://github.com/bulletmark/dbus-action/blob/master/dbus-action.conf).
296+
297+
The [`dbus-action`][DBUS] utility can also be used any similar
298+
situation, e.g. when you remove/insert a detachable touchpad. It can be
299+
used to stop, start, or restart `libinput-gestures` on any D-Bus event.
300+
247301
### TROUBLESHOOTING
248302

249303
Please don't raise a github issue but provide little information about
@@ -257,12 +311,16 @@ configuration you are using, regardless of what the issue is about**.
257311

258312
2. Ensure you have followed the installation instructions here
259313
carefully. The most common mistake is that you have not added your
260-
user to the _input_ group and re-logged in as described above.
314+
user to the _input_ group and rebooted your system as described
315+
above.
261316

262317
3. Perhaps temporarily remove your custom configuration to try with the
263318
default configuration.
264319

265-
4. Run `libinput-gestures` on the command line in debug mode while
320+
4. Run `libinput-gestures-setup status` and confirm it reports the set
321+
up that you expect.
322+
323+
5. Run `libinput-gestures` on the command line in debug mode while
266324
performing some 3 and 4 finger left/right/up/down swipes, and some
267325
pinch in/outs. In debug mode, configured commands are not executed,
268326
they are merely output to the screen:
@@ -272,7 +330,7 @@ configuration you are using, regardless of what the issue is about**.
272330
(<ctrl-c> to stop)
273331
````
274332

275-
5. Run `libinput-gestures` in raw mode by repeating the same commands as
333+
6. Run `libinput-gestures` in raw mode by repeating the same commands as
276334
above step but use the `-r` (`--raw`) switch instead of `-d`
277335
(`--debug`). Raw mode does nothing more than echo the raw gesture
278336
events received from `libinput debug-events`. If you see `POINTER_*`
@@ -283,11 +341,11 @@ configuration you are using, regardless of what the issue is about**.
283341
is done completely within libinput, before they get to
284342
`libinput-gestures`.
285343

286-
6. Search the web for Linux kernel and/or libinput issues relating to
344+
7. Search the web for Linux kernel and/or libinput issues relating to
287345
your specific touchpad device and/or laptop/pc. Update your BIOS if
288346
possible.
289347

290-
7. Be sure that a configured external command works exactly how you want
348+
8. Be sure that a configured external command works exactly how you want
291349
when you run it directly on the command line, **before** you configure
292350
it for `libinput-gestures`. E.g. run `xdotool` manually and
293351
experiment with various arguments to work out exactly what arguments
@@ -297,7 +355,7 @@ configuration you are using, regardless of what the issue is about**.
297355
`xdotool` command does not work correctly then there is no point
298356
raising an `libinput-gestures` issue about it!
299357

300-
8. **If you raise an issue, always include the output of
358+
9. **If you raise an issue, always include the output of
301359
`libinput-gestures -l` to show the environment and configuration you
302360
are using**. If appropriate, also paste the output from steps 4 and 5
303361
above. If your device is not being recognised by `libinput-gestures`
@@ -318,6 +376,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
318376
Public License at <https://www.gnu.org/licenses/> for more details.
319377

320378
[REPO]: https://github.com/bulletmark/libinput-gestures/
379+
[DBUS]: https://github.com/bulletmark/dbus-action/
321380
[AUR]: https://aur.archlinux.org/packages/libinput-gestures/
322381
[XDOTOOL]: https://www.semicomplete.com/projects/xdotool/
323382

0 commit comments

Comments
 (0)