File libinput-gestures-2.52.obscpio of Package libinput-gestures

07070100000000000081A4000003E800000064000000015F6B42E500000059000000000000000000000000000000000000001F00000000libinput-gestures-2.52/.flake8[flake8]
ignore = E126,E127,E128,E302,E305,E401
max-line-length = 80
max-complexity = 30
07070100000001000041ED000003E800000064000000035F6B42E500000000000000000000000000000000000000000000001F00000000libinput-gestures-2.52/.github07070100000002000041ED000003E800000064000000025F6B42E500000000000000000000000000000000000000000000002E00000000libinput-gestures-2.52/.github/ISSUE_TEMPLATE07070100000003000081A4000003E800000064000000015F6B42E500000151000000000000000000000000000000000000003C00000000libinput-gestures-2.52/.github/ISSUE_TEMPLATE/Bug_report.md---
name: New Issue
about: Create a new issue report

---

Before creating a new issue, please follow each step in the TROUBLESHOOTING section
of the main README.

```
Run libinput-gestures -l on the command line and paste the output here.
```

**Describe the issue**
A clear and concise description of what the issue is.
07070100000004000081A4000003E800000064000000015F6B42E5000004EF000000000000000000000000000000000000002000000000libinput-gestures-2.52/Makefile# Copyright (C) 2015 Mark Blakeney. This program is distributed under
# the terms of the GNU General Public License.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or any
# later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License at <http://www.gnu.org/licenses/> for more
# details.

DOC = README.md
SHELLCHECK_OPTS = -eSC2053,SC2064,SC2086,SC1117,SC2162,SC2181,SC2034,SC1090,SC2115

DOCOUT = $(DOC:.md=.html)

all:
	@echo "Type sudo make install|uninstall"

install:
	@./libinput-gestures-setup -d "$(DESTDIR)" install

uninstall:
	@./libinput-gestures-setup -d "$(DESTDIR)" uninstall

check:
	flake8 libinput-gestures internal internal-test
	shellcheck $(SHELLCHECK_OPTS) libinput-gestures-setup list-version-hashes
	vermin -i -q -t 3.5 --no-tips libinput-gestures
	vermin -i -q --no-tips internal internal-test

doc:	$(DOCOUT)

$(DOCOUT): $(DOC)
	markdown $< >$@

test:
	@./internal-test

clean:
	rm -rf $(DOCOUT)
07070100000005000081A4000003E800000064000000015F6B42E500003B12000000000000000000000000000000000000002100000000libinput-gestures-2.52/README.md### LIBINPUT-GESTURES

[Libinput-gestures][REPO] is a utility which reads [libinput
gestures](https://wayland.freedesktop.org/libinput/doc/latest/gestures.html)
from your touchpad and maps them to gestures you configure in a
configuration file. Each gesture can be configured to activate a shell
command which is typically an [_xdotool_][XDOTOOL] command to action
desktop/window/application keyboard combinations and commands. See the
examples in the provided `libinput-gestures.conf` file. My motivation
for creating this is to use triple swipe up/down to switch workspaces,
and triple swipe right/left to go backwards/forwards in my browser, as
per the default configuration.

This small and simple utility is only intended to be used temporarily
until GNOME and other DE's action libinput gestures natively. It parses
the output of the _libinput list-devices_ and _libinput debug-events_
utilities so is a little fragile to any version changes in their output
format.

This utility is developed and tested on Arch linux using the GNOME 3 DE
on Xorg and Wayland. It works somewhat incompletely on Wayland (via
XWayland). See the WAYLAND section below and the comments in the default
`libinput-gestures.conf` file. It has been [reported to work with
KDE](http://www.lorenzobettini.it/2017/02/touchpad-gestures-in-linux-kde-with-libinput-gestures/).
I am not sure how well this will work on all distros and DE's etc.

The latest version and documentation is available at
https://github.com/bulletmark/libinput-gestures.

### INSTALLATION

IMPORTANT: You must be a member of the _input_ group to have permission
to read the touchpad device:

    sudo gpasswd -a $USER input

After executing the above command, reboot your system.

NOTE: Arch users can just install [_libinput-gestures from the
AUR_][AUR]. Then skip to the next CONFIGURATION section.

You need python 3.5 or later, python2 is not supported. You also need
libinput release 1.0 or later. Install prerequisites:

    # E.g. On Arch:
    sudo pacman -S xdotool wmctrl

    # E.g. On Debian based systems, e.g. Ubuntu:
    sudo apt-get install xdotool wmctrl

    # E.g. On Fedora:
    sudo dnf install xdotool wmctrl

Debian and Ubuntu users may also need to install `libinput-tools` if
that package exists in your release:

    sudo apt-get install libinput-tools

Install this software:

    git clone https://github.com/bulletmark/libinput-gestures.git
    cd libinput-gestures
    sudo make install (or sudo ./libinput-gestures-setup install)

### CONFIGURATION

It is helpful to start by reading the documentation about [what libinput
calls gestures](https://wayland.freedesktop.org/libinput/doc/latest/gestures.html).
Many users will be happy with the default configuration in which case
you can just type the following and you are ready to go:

    libinput-gestures-setup autostart
    libinput-gestures-setup start

Otherwise, if you want to create your own custom gestures etc, keep
reading ..

The default gestures are in `/etc/libinput-gestures.conf`. If you want
to create your own custom gestures then copy that file to
`~/.config/libinput-gestures.conf` and edit it. There are many examples
and options described in that file. The available gestures are:

|Gesture               |Example Mapping |
|-------               |--------------- |
|`swipe up`            |GNOME/KDE/etc move to next workspace |
|`swipe down`          |GNOME/KDE/etc move to prev workspace |
|`swipe left`          |Web browser go forward |
|`swipe right`         |Web browser go back |
|`swipe left_up`       |Jump to next open web browser tab |
|`swipe left_down`     |Jump to previous open web browser tab |
|`swipe right_up`      |Close current web browser tab |
|`swipe right_down`    |Reopen and jump to last closed web browser tab |
|`pinch in`            |GNOME open/close overview |
|`pinch out`           |GNOME open/close overview |
|`pinch clockwise`     ||
|`pinch anticlockwise` ||

NOTE: If you don't use "natural" scrolling direction for your touchpad
then you may want to swap the default left/right and up/down
configurations.

You can choose to specify a specific finger count, typically [3 or more
fingers for swipe](https://wayland.freedesktop.org/libinput/doc/latest/gestures.html#swipe-gestures),
and [2 or more for pinch](https://wayland.freedesktop.org/libinput/doc/latest/gestures.html#pinch-gestures).
If a finger count is specified then the command is executed when exactly that
number of fingers is used in the gesture. If not specified then the
command is executed when that gesture is invoked with any number of
fingers. Gestures specified with finger count have priority over the
same gesture specified without any finger count.

Of course, 2 finger swipes and taps are already interpreted by your DE
and apps [for scrolling](https://wayland.freedesktop.org/libinput/doc/latest/scrolling.html#two-finger-scrolling) etc.

IMPORTANT: Test the program. Check for reported errors in your custom
gestures, missing packages, etc:

    # Ensure the program is stopped
    libinput-gestures-setup stop

    # Test to print out commands that would be executed:
    libinput-gestures -d
    (<ctrl-c> to stop)

Confirm that the correct commands are reported for your 3 finger
swipe up/down/left/right gestures, and your 2 or 3 finger pinch
in/out gestures. Some touchpads can also support 4 finger gestures.
If you have problems then follow the TROUBLESHOOTING steps below.

Apart from simple environment variable and `~` substitutions within the
configured command name, `libinput-gestures` does not run the configured
command under a shell so shell argument substitutions and expansions etc
will not be parsed. This is for efficiency and because most don't need
it. This also means your `PATH` is not respected of course so you must
specify the full path to any command. If you need something more
complicated, you can add your commands in an executable personal script,
e.g. `~/bin/libinput-gestures.sh` e.g. with a `#!/bin/sh` shebang . Run
that script by hand until you get it working then configure the script
path as your command in your `libinput-gestures.conf`.

In most cases, `libinput-gestures` automatically determines your
touchpad device. However, you can specify it in your configuration file
if needed. If you have multiple touchpads you can also specify
`libinput-gestures` to use all devices. See the notes in the default
`libinput-gestures.conf` file about the `device` configuration command.

### STARTING AND STOPPING

Start the application immediately in the background using the command
line utility:

    libinput-gestures-setup start

You can stop the background app with:

    libinput-gestures-setup stop

You can enable the app to start automatically in the background when you
log in (on an XDG compliant DE such as GNOME and KDE) with:

    libinput-gestures-setup autostart

You can disable the app from starting automatically with:

    libinput-gestures-setup autostop

You can restart the app or reload the configuration file with:

    libinput-gestures-setup restart

You can check the status of the app with:

    libinput-gestures-setup status

Note on some uncommon systems `libinput-gestures-setup start` may fail
to start the application returning you a message _Don't know how to
invoke libinput-gestures.desktop_. If you get this error message,
install the dex package, preferably from your system packages
repository, and try again.

### UPGRADE

    # cd to source dir, as above
    git pull
    sudo make install (or sudo ./libinput-gestures-setup install)
    libinput-gestures-setup restart

### REMOVAL

    libinput-gestures-setup stop
    libinput-gestures-setup autostop
    sudo libinput-gestures-setup uninstall

### WAYLAND AND OTHER NOTES

This utility exploits `xdotool` which unfortunately only works with
X11/Xorg based applications. So `xdotool` shortcuts for the desktop do
not work under GNOME on Wayland which is the default since GNOME
3.22. However, it is found that `wmctrl` desktop selection commands do work
under GNOME on Wayland (via XWayland) so this utility adds a built-in
`_internal` command which can be used to switch workspaces using the
swipe commands.
The `_internal` `ws_up` and `ws_down` commands use `wmctrl` to work out
the current workspace and select the next one. Since this works on both
Wayland and Xorg, and with GNOME, KDE, and other EWMH compliant
desktops, it is the default configuration command for swipe up and
down commands in `libinput-gestures.conf`. See the comments in that file
about other options you can do with the `_internal` command.
Unfortunately `_internal` does not work with Compiz for Ubuntu
Unity desktop so also see the explicit example there for Unity.

Of course, `xdotool` commands do work via XWayland for Xorg based apps
so, for example, page forward/back swipe gestures do work for Firefox
and Chrome browsers when running on Wayland as per the default
configuration.

Note that GNOME on Wayland natively implements the following gestures:

- 3 finger pinch opens/close the GNOME overview.
- 4 finger swipe up/down changes workspaces.

So if you choose to run `libinput-gestures` on Wayland, be sure to
change or disable the your `libinput-gestures.conf` pinch and swipe
up/down gestures to not clash with these. E.g, configure your
`libinput-gestures.conf` pinch gestures for only 2 fingers, and the
swipe up/down for only 3 fingers so they work independently of the
native gestures.

GNOME on Xorg does not natively implement any gestures.

### EXTENDED GESTURES

They are not enabled in the default `libinput-gestures.conf`
configuration file but you can enable extended gestures which augment
the gestures listed above in CONFIGURATION. See the commented out
examples in `libinput-gestures.conf`.

- `swipe right_up` (e.g. jump to next open browser tab)
- `swipe left_up` (e.g. jump to previous open browser tab)
- `swipe left_down` (e.g. close current browser tab)
- `swipe right_down` (e.g. reopen and jump to last closed browser tab)
- `pinch clockwise`
- `pinch anticlockwise`

So instead of just configuring the usual swipe up/down and left/right
each at 90 degrees separation, you can add the above extra 4 swipes to
give a total of 8 swipe gestures each at 45 degrees separation. It works
better than you may expect, at least after some practice. It means you
can completely manage browser tabs from your touchpad.

### AUTOMATIC STOP/RESTART ON D-BUS EVENTS SUCH AS SUSPEND

There are some situations where you may want to automatically stop,
start, or restart `libinput-gestures`. E.g. some touchpads have a
problem which causes `libinput-gestures` (actually the underlying
`libinput debug-events`) to hang after resuming from a system suspend so
those users want to stop `libinput-gestures` when a system goes into
suspend and then start it again with resuming. You can use a companion
program [`dbus-action`][DBUS] to
do this. See the example configuration for `libinput-gestures` in the
default [`dbus-action`][DBUS] [configuration
file](https://github.com/bulletmark/dbus-action/blob/master/dbus-action.conf).

The [`dbus-action`][DBUS] utility can also be used any similar
situation, e.g. when you remove/insert a detachable touchpad. It can be
used to stop, start, or restart `libinput-gestures` on any D-Bus event.

### TROUBLESHOOTING

Please don't raise a github issue but provide little information about
your problem, and please don't raise an issue until you have considered
all the following steps. **If you raise an issue ALWAYS include the
output of `libinput-gestures -l` to show the environment and
configuration you are using, regardless of what the issue is about**.

1. Ensure you are running the latest version from the
   [libinput-gestures github repository][REPO] or from the [Arch AUR][AUR].

2. Ensure you have followed the installation instructions here
   carefully. The most common mistake is that you have not added your
   user to the _input_ group and rebooted your system as described
   above.

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

4. Run `libinput-gestures` on the command line in debug mode while
   performing some 3 and 4 finger left/right/up/down swipes, and some
   pinch in/outs. In debug mode, configured commands are not executed,
   they are merely output to the screen:
   ````
	libinput-gestures-setup stop
	libinput-gestures -d
	(<ctrl-c> to stop)
   ````

5. Run `libinput-gestures` in raw mode by repeating the same commands as
   above step but use the `-r` (`--raw`) switch instead of `-d`
   (`--debug`). Raw mode does nothing more than echo the raw gesture
   events received from `libinput debug-events`. If you see `POINTER_*`
   events but no `GESTURE_*` events then unfortunately your touchpad
   and/or libinput combination can report simple finger movements but
   does not report multi-finger gestures so `libinput-gestures` will not
   work. Also note that discrimination of `SWIPE` and `PINCH` gestures
   is done completely within libinput, before they get to
   `libinput-gestures`.

6. Search the web for Linux kernel and/or libinput issues relating to
   your specific touchpad device and/or laptop/pc. Update your BIOS if
   possible.

7. Be sure that a configured external command works exactly how you want
   when you run it directly on the command line, **before** you configure
   it for `libinput-gestures`. E.g. run `xdotool` manually and
   experiment with various arguments to work out exactly what arguments
   it requires to do what you want, and only then add that command +
   arguments to your custom configuration in
   `~/.config/libinput-gestures.conf`. Clearly, if the your manual
   `xdotool` command does not work correctly then there is no point
   raising an `libinput-gestures` issue about it!

8. **If you raise an issue, always include the output of
   `libinput-gestures -l` to show the environment and configuration you
   are using**. If appropriate, also paste the output from steps 4 and 5
   above. If your device is not being recognised by `libinput-gestures`
   at all, paste the complete output of `libinput list-devices`
   (`libinput-list-devices` on libinput < v1.8).

### LICENSE

Copyright (C) 2015 Mark Blakeney. This program is distributed under the
terms of the GNU General Public License.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License at <https://www.gnu.org/licenses/> for more details.

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

<!-- vim: se ai syn=markdown: -->
07070100000006000081ED000003E800000064000000015F6B42E500000CF6000000000000000000000000000000000000002000000000libinput-gestures-2.52/internal#!/usr/bin/env python3
'Command line program to exercise/test/debug the _internal command.'
# Mark Blakeney, Oct 2019
import sys, importlib, argparse
from pathlib import Path

CMD = '_internal'
GESTURE = 'swipe'
PROG = Path(sys.argv[0]).resolve()
NAME = Path.cwd().name
CACHE = Path.home() / '.cache' / PROG.name

def import_path(path, add_to_path=False):
    'Import given module path'
    modname = Path(path).stem.replace('-', '_')
    spec = importlib.util.spec_from_loader(modname,
            importlib.machinery.SourceFileLoader(modname, path))
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    if add_to_path:
        sys.modules[modname] = module
    return module

opt = argparse.ArgumentParser(description=__doc__)
opt.add_argument('-c', '--conffile',
        help='alternative configuration file')
opt.add_argument('-i', '--initial', type=int,
        help='initial desktop')
opt.add_argument('-C', '--cols', type=int, default=1,
        help='number of columns')
opt.add_argument('-t', '--text', action='store_true',
        help='output desktop change in text')
opt.add_argument('-n', '--nocache', action='store_true',
        help='do not use cache')
opt.add_argument('num', type=int,
        help='number of desktops')
opt.add_argument('action', nargs='?',
        help='action to perform')
opt.add_argument('-d', '--display', type=int,
        help=argparse.SUPPRESS)
opt.add_argument('-s', '--set', type=int, help=argparse.SUPPRESS)
args = opt.parse_args()

def showgrid(pos, num, cols):
    print()
    for i in range(num):
        end = '\n' if (i % cols) == (cols - 1) else ''
        if i == pos:
            print(' {:02} '.format(i), end=end)
        else:
            print(' ** ', end=end)
    if end != '\n':
        print()

if args.set is not None:
    print(args.set)
    sys.exit(0)

if args.display is not None:
    for i in range(args.num):
        print('{} {} -'.format(i, '*' if i == args.display else '-'))
    sys.exit(0)

if args.initial is None:
    if args.nocache:
        opt.error('Initial value must be specified')
    if not CACHE.exists():
        opt.error('Need initial desktop specified')
    start = int(CACHE.read_text().strip())
else:
    start = args.initial

lg = import_path(NAME)
icmd = lg.internal_commands[CMD]

icmd.CMDLIST = '{} -d {} {}'.format(PROG, start, args.num).split()
icmd.CMDSET = '{} {} -s'.format(PROG, args.num).split()

lg.read_conf(args.conffile, NAME + '.conf')
motions = lg.handlers[GESTURE.upper()].motions
actions = {k: v for k, v in motions.items() if isinstance(v, icmd)}

if not args.action or args.action not in actions:
    opt.error('action must be one of {}'.format(list(actions.keys())))

cmd = motions[args.action]
print('Command "{} {} is "{}"'.format(GESTURE, args.action, cmd))
res = cmd.run(block=True)

if res:
    end = int(res.strip())
    if not args.nocache:
        CACHE.write_text(str(end))
else:
    end = start

if end < 0 or end >= args.num:
    sys.exit('Desktop change from {} to {}, out of range 0 to <{}!'.format(
        start, end, args.num))

if args.text:
    if start != end:
        print('Desktop change from {} to {}'.format(start, end))
    else:
        print('No change')
else:
    showgrid(start, args.num, args.cols)
    showgrid(end, args.num, args.cols)
07070100000007000081ED000003E800000064000000015F6B42E50000286F000000000000000000000000000000000000002500000000libinput-gestures-2.52/internal-test#!/usr/bin/env python3
'Command line utility to run test suite for internal command.'
# Mark Blakeney, Oct 2019
import sys, tempfile, subprocess, argparse

# flake8: noqa: E122
TESTS = (
#####
(
'1 column, up/down, no wrap',
'''
gesture swipe up		_internal ws_up
gesture swipe down		_internal ws_down
''', (
    '3 desktops',
    ('up',   1, 3),
    ('up',   2),
    ('up',   2),
    ('down', 1),
    ('down', 0),
    ('down', 0),
),
),
#####
(
'1 column, up/down, with wrap',
'''
gesture swipe up		_internal -w ws_up
gesture swipe down		_internal -w ws_down
''', (
    '3 desktops',
    ('up',   1, 3),
    ('up',   2),
    ('up',   0),
    ('up',   1),
    ('up',   2),
    ('up',   0),
    ('down', 2),
    ('down', 1),
    ('down', 0),
    ('down', 2),
),
),
#####
(
'1 row, left/right, no wrap',
'''
gesture swipe left		_internal ws_left
gesture swipe right		_internal ws_right
''', (
    '3 desktops',
    ('left',  1, 3),
    ('left',  2),
    ('left',  2),
    ('right', 1),
    ('right', 0),
    ('right', 0),
),
),
#####
(
'1 row, left/right, no wrap, configured as columns',
'''
gesture swipe left		_internal -c 3 ws_left
gesture swipe right		_internal -c 3 ws_right
''', (
    '3 desktops',
    ('left',  1, 3),
    ('left',  2),
    ('left',  2),
    ('right', 1),
    ('right', 0),
    ('right', 0),
),
),
#####
(
'1 row, left/right, with wrap',
'''
gesture swipe left		_internal -w ws_left
gesture swipe right		_internal -w ws_right
''', (
    '3 desktops',
    ('left',  1, 3),
    ('left',  2),
    ('left',  0),
    ('left',  1),
    ('left',  2),
    ('left',  0),
    ('right', 2),
    ('right', 1),
    ('right', 0),
    ('right', 2),
),
),
#####
(
'1 row, left/right, with wrap, configured as columns',
'''
gesture swipe left		_internal -w -c 3 ws_left
gesture swipe right		_internal -w -c 3 ws_right
''', (
    '3 desktops',
    ('left',  1, 3),
    ('left',  2),
    ('left',  0),
    ('left',  1),
    ('left',  2),
    ('left',  0),
    ('right', 2),
    ('right', 1),
    ('right', 0),
    ('right', 2),
),
),
#####
(
'4 column, up/down/left/right, no wrap',
'''
gesture swipe up		_internal -c 4 ws_up
gesture swipe down		_internal -c 4 ws_down
gesture swipe left		_internal -c 4 ws_left
gesture swipe right		_internal -c 4 ws_right
''', (
    '12 desktops',
    ('up',    4, 12),
    ('up',    8),
    ('up',    8),
    ('down',  4),
    ('down',  0),
    ('down',  0),
    ('left',  1),
    ('left',  2),
    ('left',  3),
    ('left',  3),
    ('right', 2),
    ('right', 1),
    ('right', 0),
    ('right', 0),
    ('left',  1),
    ('up',    5),
    ('up',    9),
    ('up',    9),
    ('left',  10),
    ('up',    10),
    ('down',  6),
    ('down',  2),
    ('down',  2),
    ('left',  3),
    ('up',    7),
    ('up',    11),
    ('up',    11),
    '10 desktops',
    ('up',    4, 10),
    ('up',    8),
    ('up',    8),
    ('left',  9),
    ('left',  9),
    ('down',  5),
    ('left',  6),
    ('up',    6),
    ('left',  7),
    ('left',  7),
    ('up',    7),
    ('down',  3),
    ('down',  3),
),
),
#####
(
'4 column, up/down/left/right, no wrap, legacy config',
'''
gesture swipe up		_internal --col=3 ws_up
gesture swipe down		_internal --col=3 ws_down
gesture swipe left		_internal --row=4 ws_up
gesture swipe right		_internal --row=4 ws_down
''', (
    '12 desktops',
    ('up',    4, 12),
    ('up',    8),
    ('up',    8),
    ('down',  4),
    ('down',  0),
    ('down',  0),
    ('left',  1),
    ('left',  2),
    ('left',  3),
    ('left',  3),
    ('right', 2),
    ('right', 1),
    ('right', 0),
    ('right', 0),
    ('left',  1),
    ('up',    5),
    ('up',    9),
    ('up',    9),
    ('left',  10),
    ('up',    10),
    ('down',  6),
    ('down',  2),
    ('down',  2),
    ('left',  3),
    ('up',    7),
    ('up',    11),
    ('up',    11),
),
),
#####
(
'4 column, up/down/left/right, with wrap',
'''
gesture swipe up		_internal -w -c 4 ws_up
gesture swipe down		_internal -w -c 4 ws_down
gesture swipe left		_internal -w -c 4 ws_left
gesture swipe right		_internal -w -c 4 ws_right
''', (
    '12 desktops',
    ('up',    4, 12),
    ('up',    8),
    ('up',    0),
    ('down',  8),
    ('down',  4),
    ('down',  0),
    ('down',  8),
    ('up'  ,  0),
    ('right', 3),
    ('left',  0),
    ('left',  1),
    ('left',  2),
    ('left',  3),
    ('left',  0),
    ('right', 3),
    ('up',    7),
    ('up',    11),
    ('up',    3),
    '10 desktops',
    ('up',    4, 10),
    ('up',    8),
    ('up',    0),
    ('down',  8),
    ('left',  9),
    ('left',  8),
    ('left',  9),
    ('up',    1),
    ('up',    5),
    ('up',    9),
    ('down',  5),
    ('left',  6),
    ('left',  7),
    ('left',  4),
    ('right', 7),
    ('right', 6),
    ('up',    2),
    ('down', 6),
),
),
#####
(
'4 column, up/down/left/right, with wrap, legacy config',
'''
gesture swipe up		_internal -w --col=3 ws_up
gesture swipe down		_internal -w --col=3 ws_down
gesture swipe left		_internal -w --row=4 ws_up
gesture swipe right		_internal -w --row=4 ws_down
''', (
    '12 desktops',
    ('up',    4, 12),
    ('up',    8),
    ('up',    0),
    ('down',  8),
    ('down',  4),
    ('down',  0),
    ('down',  8),
    ('up'  ,  0),
    ('right', 3),
    ('left',  0),
    ('left',  1),
    ('left',  2),
    ('left',  3),
    ('left',  0),
    ('right', 3),
    ('up',    7),
    ('up',    11),
    ('up',    3),
    ('down',  11),
),
),
#####
(
'4 column, up/down/left/right & diagonal, no wrap',
'''
gesture swipe up		_internal -c 4 ws_up
gesture swipe down		_internal -c 4 ws_down
gesture swipe left		_internal -c 4 ws_left
gesture swipe right		_internal -c 4 ws_right
gesture swipe left_up		_internal -c 4 ws_left_up
gesture swipe left_down		_internal -c 4 ws_left_down
gesture swipe right_up		_internal -c 4 ws_right_up
gesture swipe right_down	_internal -c 4 ws_right_down
''', (
    '12 desktops',
    ('left_up',    5, 12),
    ('left_up',    10),
    ('right_down', 5),
    ('right_down', 0),
    ('left',       1),
    ('left_up',    6),
    ('left_up',    11),
    ('down',       7),
    ('right_down', 2),
    ('left',       3),
    ('left',       3),
    ('right_up',   6),
    ('right_up',   9),
    ('right_up',   9),
    '10 desktops',
    ('left_up',    5, 10),
    ('left_up',    5),
    ('right_down', 0),
    ('left',       1),
    ('left_up',    6),
    ('left_up',    6),
    ('left_down',  3),
    ('up',         7),
    ('right_up',   7),
    ('right_down', 2),
    ('right_up',   5),
    ('right_up',   8),
    ('right_up',   8),
    '16 desktops',
    ('left_up',    5, 16),
    ('left_up',    10),
    ('left_up',    15),
    ('left_up',    15),
    ('right_down', 10),
    ('right_down', 5),
    ('right_down', 0),
    ('right_down', 0),
    ('up',         4),
    ('up',         8),
    ('up',         12),
    ('right_down', 12),
    ('left_down',  9),
    ('left_down',  6),
    ('left_down',  3),
    ('left_down',  3),
    ('right_up',   6),
    ('right_up',   9),
    ('right_up',   12),
),
),
#####
(
'4 column, up/down/left/right & diagonal, with wrap',
'''
gesture swipe up		_internal -w -c 4 ws_up
gesture swipe down		_internal -w -c 4 ws_down
gesture swipe left		_internal -w -c 4 ws_left
gesture swipe right		_internal -w -c 4 ws_right
gesture swipe left_up		_internal -w -c 4 ws_left_up
gesture swipe left_down		_internal -w -c 4 ws_left_down
gesture swipe right_up		_internal -w -c 4 ws_right_up
gesture swipe right_down	_internal -w -c 4 ws_right_down
''', (
    '12 desktops',
    ('left_up',    5, 12),
    ('left_up',    10),
    ('left_up',    3),
    ('left_up',    4),
    ('left_up',    9),
    ('left_up',    2),
    ('left_up',    7),
    ('down',       3),
    ('right_up',   6),
    ('right_up',   9),
    ('right_up',   0),
    '10 desktops',
    ('left_up',    5, 10),
    ('left_up',    2),
    ('left',       3),
    ('right_up',   6),
    ('right_up',   9),
    ('right_up',   0),
    '16 desktops',
    ('left_up',    5, 16),
    ('left_up',    10),
    ('left_up',    15),
    ('left_up',    0),
    ('right_down', 15),
    ('right_down', 10),
    ('right_down', 5),
    ('right_down', 0),
    ('right_down', 15),
    ('left_up',    0),
    ('up',         4),
    ('up',         8),
    ('up',         12),
    ('right_up',   3),
    ('right_up',   6),
    ('right_up',   9),
    ('right_up',   12),
),
),
)

PROG = 'internal'

opt = argparse.ArgumentParser(description=__doc__)
opt.add_argument('-q', '--quiet', action='store_true',
        help='quiet output')
opt.add_argument('-l', '--list', action='store_true',
        help='list test sets')
opt.add_argument('testset', nargs='*', type=int,
        help='test sets to execute, default all {}'.format(len(TESTS)))
args = opt.parse_args()

lastnum = 0
lastpos = 0

def test(fname, action, end, num=-1, start=-1):
    global lastnum, lastpos
    if num < 0:
        num = lastnum
    else:
        lastpos = 0

    if start < 0:
        start = lastpos

    lastnum = num
    lastpos = end

    cmd = './{} -n -t -c {} -i {} {} {}'.format(PROG, fname, start, num, action)
    res = subprocess.run(cmd.split(), universal_newlines=True,
            stdout=subprocess.PIPE)
    if res.returncode != 0:
        return 'Command failed'
    out = res.stdout.strip().splitlines()[-1].split()[-1]
    res_end = int(out) if out.isdigit() else start
    return 'should be {}'.format(res_end) if res_end != end else None

tmpfile = tempfile.NamedTemporaryFile('r+t')
sets = 0
total = 0
bad = 0

for testset, (title, confstr, tests) in enumerate(TESTS, 1):
    if args.testset and testset not in args.testset:
        continue
    sets += 1
    confstr = confstr.strip()
    tmpfile.seek(0)
    tmpfile.write(confstr + '\n')
    tmpfile.truncate()
    tmpfile.flush()
    lastpos = 0
    lastnum = 0
    print('======= Set {}: {}:\n{}'.format(testset, title, confstr))
    for fargs in tests:
        if isinstance(fargs, str):
            print(' ###### Subset {}:'.format(fargs))
            continue
        total += 1

        if args.list:
            continue

        res = test(tmpfile.name, *fargs)
        if res:
            print(' FAILED: {}: {}'.format(fargs, res))
            bad += 1
        elif not args.quiet:
            print(' ok    : {}'.format(fargs))

print('\nTotal sets = {}, tests = {}, failed = {}'.format(sets, total, bad))
sys.exit(0 if bad == 0 else 1)
07070100000008000081ED000003E800000064000000015F6B42E5000065D0000000000000000000000000000000000000002900000000libinput-gestures-2.52/libinput-gestures#!/usr/bin/env python3
'Read gestures from libinput touchpad and action shell commands.'
# Mark Blakeney, Sep 2015
import os
import sys
import argparse
import subprocess
import shlex
import re
import getpass
import fcntl
import platform
import math
import hashlib
from time import monotonic
from collections import OrderedDict
from pathlib import Path
from distutils.version import LooseVersion as Version

PROGPATH = Path(sys.argv[0])
PROGNAME = PROGPATH.stem

# Conf file containing gesture commands.
# Search first for user file then system file.
CONFNAME = '{}.conf'.format(PROGNAME)
USERDIR = os.getenv('XDG_CONFIG_HOME', os.path.expanduser('~/.config'))
CONFDIRS = (USERDIR, '/etc')

# Ratio of X/Y (or Y/X) at which we consider an oblique swipe gesture.
# The number is the trigger angle in degrees and set to 360/8/2.
OBLIQUE_RATIO = math.tan(math.radians(22.5))

# Default minimum significant distance to move for swipes, in dots.
# Can be changed using configuration command.
swipe_min_threshold = 0

args = None
abzsquare = None

# Timeout on gesture action from start to end. 0 = no timeout. In secs.
# Can be changed using configuration command.
DEFAULT_TIMEOUT = 1.5
timeoutv = DEFAULT_TIMEOUT

# Rotation threshold in degrees to discriminate pinch rotate from in/out
ROTATE_ANGLE = 15.0

def open_lock(*args):
    'Create a lock based on given list of arguments'
    # We use exclusive assess to a file for this
    fp = Path('/tmp', '-'.join(args) + '.lock').open('w')
    try:
        fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
    except IOError:
        return None

    return fp

def run(cmd, *, check=True, block=True):
    'Run function and return standard output, Popen() handle, or None'
    try:
        if block:
            result = subprocess.check_output(cmd, universal_newlines=True,
                    stderr=(None if check else subprocess.DEVNULL))
        else:
            result = bool(subprocess.Popen(cmd))
    except Exception as e:
        result = None
        if check:
            print(str(e), file=sys.stderr)

    return result

def get_libinput_vers():
    'Return the libinput installed version number string'
    # Try to use newer libinput interface then fall back to old
    # (depreciated) interface.
    res = run(('libinput', '--version'), check=False)
    return res.strip() if res else \
            run(('libinput-list-devices', '--version'), check=False)

def get_devices_list(cmd_list_devices, device_list):
    'Get list of devices and their attributes (as a dict) from libinput'
    if device_list:
        with open(device_list) as fd:
            stdout = fd.read()
    else:
        stdout = run(cmd_list_devices.split())

    if stdout:
        dev = {}
        for line in stdout.splitlines():
            line = line.strip()
            if line and ':' in line:
                key, value = line.split(':', maxsplit=1)
                dev[key.strip().lower()] = value.strip()
            elif dev:
                yield dev
                dev = {}

        # Ensure we include last device
        if dev:
            yield dev

def get_device_info(name, cmd_list_devices, device_list):
    'Determine libinput touchpad device and return device info'
    devices = list(get_devices_list(cmd_list_devices, device_list))

    if not devices:
        print('Can not see any devices, did you add yourself to the '
                'input group and reboot?', file=sys.stderr)
        return None

    # If a specific device name was asked for then return that device
    # This is the "Device" name from libinput list-devices command.
    if name:
        kdev = str(Path(name).resolve()) if name[0] == '/' else None
        for d in devices:
            # If the device name starts with a '/' then it is instead
            # considered as the explicit device path although since
            # device paths can change through reboots this is best to be
            # a symlink. E.g. users should use the corresponding full
            # path link under /dev/input/by-path/ or /dev/input/by-id/.
            if kdev:
                if d.get('kernel') == kdev:
                    return d
            elif d.get('device') == name:
                return d
        return None

    # Otherwise look for 1st device with touchpad capabilities
    for d in devices:
        if 'size' in d and 'pointer' in d.get('capabilities'):
            return d
    # Otherwise look for 1st device with touchpad in it's name
    # or, failing that, 1st device with trackpad in it's name
    for txt in ('touch ?pad', 'track ?pad'):
        for d in devices:
            if re.search(txt, d.get('device', ''), re.I):
                return d

    # Give up
    return None

def get_device(name, cmd_list_devices, device_list):
    'Determine libinput touchpad device and add fixed path info'
    dev = get_device_info(name, cmd_list_devices, device_list)
    if dev:
        devname = dev.get('kernel')
        evname = ''
        if devname:
            devpath = Path(devname)

            # Also determine and prefer a non-volatile path merely
            # because it is more identifying for users.
            for dirstr in ('/dev/input/by-path', '/dev/input/by-id'):
                dirpath = Path(dirstr)
                if dirpath.exists():
                    for path in dirpath.iterdir():
                        if path.resolve() == devpath:
                            devname = str(path)
                            evname = '({})'.format(devpath.name)
                            break
                    if evname:
                        break

        dev['_path'] = devname
        dev['_diag'] = '{}{}: {}'.format(devname, evname,
                dev.get('device', '?'))
    return dev

class COMMAND:
    'Generic command handler'
    def __init__(self, args):
        self.reprstr = ' '.join(args)

        # Expand '~' and env vars in executable command name
        args[0] = os.path.expandvars(os.path.expanduser(args[0]))
        self.argslist = args

    def run(self):
        'Run this command + arguments'
        run(self.argslist, block=False)

    def __str__(self):
        'Return string representation'
        return self.reprstr

# Table of internal commands
internal_commands = OrderedDict()

def add_internal_command(cls):
    'Add configuration command to command lookup table based on name'
    internal_commands[re.sub('^COMMAND', '', cls.__name__)] = cls

class ArgumentParser(argparse.ArgumentParser):
    'Custom ArgumentParser to return error text'
    def error(self, msg):
        raise(Exception(msg))

@add_internal_command
class COMMAND_internal(COMMAND):
    'Internal command handler.'
    # Commands currently supported follow. Each is configured with the
    # (X,Y) translation to be applied to the desktop grid.
    commands = (
        ('ws_up',         ( 0,  1)),  # noqa: E241,E201
        ('ws_down',       ( 0, -1)),  # noqa: E241,E201
        ('ws_left',       ( 1,  0)),  # noqa: E241,E201
        ('ws_right',      (-1,  0)),  # noqa: E241,E201
        ('ws_left_up',    ( 1,  1)),  # noqa: E241,E201
        ('ws_left_down',  ( 1, -1)),  # noqa: E241,E201
        ('ws_right_up',   (-1,  1)),  # noqa: E241,E201
        ('ws_right_down', (-1, -1)),  # noqa: E241,E201
    )

    commands_list = [c[0] for c in commands]

    CMDLIST = 'wmctrl -d'.split()
    CMDSET = 'wmctrl -s'.split()

    def __init__(self, args):
        'Action internal swipe commands'
        super().__init__(args)

        # Set up command line arguments
        opt = ArgumentParser(prog=self.argslist[0], description=self.__doc__)
        opt.add_argument('-w', '--wrap', action='store_true',
                help='wrap workspaces when switching to/from start/end')
        opt.add_argument('-c', '--cols', type=int,
                help='number of columns in virtual desktop grid, default=1')
        opt.add_argument('--row', type=int, default=0, help=argparse.SUPPRESS)
        opt.add_argument('--col', type=int, default=0, help=argparse.SUPPRESS)
        opt.add_argument('action', choices=self.commands_list,
                help='Internal command to action')
        args = opt.parse_args(self.argslist[1:])
        self.nowrap = not args.wrap
        self.rows = 0
        self.cols = 0
        cmdi = self.commands_list.index(args.action)

        if cmdi >= 2:
            if args.row or args.col:
                opt.error('Legacy "--row" and "--col" not supported')
            if args.cols is None:
                if cmdi < 4:
                    self.cols = 1
                    cmdi -= 2
                else:
                    opt.error('"--cols" must be specified')
            elif args.cols < 1:
                opt.error('"--cols" must be >= 1')
            else:
                self.cols = args.cols
        else:
            # Convert old legacy/depreciated arguments to new arguments
            if args.cols is not None:
                if args.cols < 1:
                    opt.error('"--cols" must be >= 1')
                self.cols = args.cols
            elif args.row:
                cmdi += 2
                self.cols = args.row
            elif args.col:
                self.rows = args.col
            else:
                self.cols = 1

        # Save the translations appropriate to this command
        self.xmove, self.ymove = self.commands[cmdi][1]

    def run(self, block=False):
        'Get list of current workspaces and select next one'
        stdout = run(self.CMDLIST, check=False)
        if not stdout:
            # This command can fail on GNOME when you have only a single
            # dynamic workspace (probably a GNOME bug) so let's just
            # fudge that default case.
            stdout = '0 *\n1 -'

        # Parse the output of above command
        lines = [ln.split(maxsplit=2)[1] for ln in stdout.strip().splitlines()]
        start = index = lines.index('*')
        num = len(lines)
        cols = self.cols or num // self.rows
        numv = ((num - 1) // cols + 1) * cols

        # Calculate new workspace X direction index
        count = self.xmove
        if count < 0:
            if index % cols == 0:
                if self.nowrap:
                    return
                index += cols - 1
                if index >= num:
                    if self.ymove == 0:
                        if self.nowrap:
                            return
                        index = num - 1
            else:
                index += count
        elif count > 0:
            index += count
            if index % cols == 0:
                if self.nowrap:
                    return
                index -= cols
            elif index >= num:
                if self.ymove == 0:
                    if self.nowrap:
                        return
                    index -= numv - index

        # Calculate new workspace Y direction index
        count = self.ymove * cols
        if count < 0:
            if index < cols and self.nowrap:
                return
            index = (index + count) % numv
            if index >= num:
                index += count
        elif count > 0:
            index += count
            if index >= numv:
                if self.nowrap:
                    return
                index = index % numv
            elif index >= num:
                if self.nowrap:
                    return
                index = (index + count) % numv

        # Switch to desired workspace
        return run(self.CMDSET + [str(index)], block=block) \
                if index != start else None

# Table of gesture handlers
handlers = OrderedDict()

def add_gesture_handler(cls):
    'Create gesture handler instance and add to lookup table based on name'
    handlers[cls.__name__] = cls()

class GESTURE:
    'Abstract base class for handling for gestures'
    def __init__(self):
        'Initialise this gesture at program start'
        self.name = type(self).__name__
        self.motions = OrderedDict()
        self.has_extended = False

    def add(self, motion, fingers, command):
        'Add a configured motion command for this gesture'
        if motion not in self.SUPPORTED_MOTIONS:
            return 'Gesture {} does not support motion "{}".\n' \
                    'Must be "{}"'.format(self.name.lower(), motion,
                            '" or "'.join(self.SUPPORTED_MOTIONS))
        if not command:
            return 'No command configured'

        # If any extended gestures configured then set flag to enable
        # their discrimination
        if self.extended_text in motion:
            self.has_extended = True

        key = (motion, fingers) if fingers else motion

        try:
            cmds = shlex.split(command)
        except Exception as e:
            return str(e)

        cls = internal_commands.get(cmds[0], COMMAND)

        try:
            self.motions[key] = cls(cmds)
        except Exception as e:
            return str(e)

        return None

    def begin(self, fingers):
        'Initialise this gesture at the start of motion'
        self.fingers = fingers
        self.data = [0.0, 0.0]
        self.starttime = monotonic()

    def action(self, motion):
        'Action a motion command for this gesture'
        command = self.motions.get((motion, self.fingers)) or \
                self.motions.get(motion)

        if args.verbose:
            print('{}: {} {} {} {}'.format(PROGNAME, self.name, motion,
                self.fingers, self.data))
            if command:
                print('  ', command)

        if timeoutv > 0 and (self.starttime + timeoutv) < monotonic():
            if args.verbose:
                print('  ', 'timeout - no action')
            return

        if command and not args.debug:
            command.run()

@add_gesture_handler
class SWIPE(GESTURE):
    'Class to handle this type of gesture'
    SUPPORTED_MOTIONS = ('left', 'right', 'up', 'down',
            'left_up', 'right_up', 'left_down', 'right_down')
    extended_text = '_'

    def update(self, coords):
        'Update this gesture for a motion'
        # Ignore this update if we can not parse the numbers we expect
        try:
            x = float(coords[2])
            y = float(coords[3])
        except (ValueError, IndexError):
            return False

        self.data[0] += x
        self.data[1] += y
        return True

    def end(self):
        'Action this gesture at the end of a motion sequence'
        x, y = self.data
        abx = abs(x)
        aby = abs(y)

        # Require absolute distance movement beyond a small thresh-hold.
        if abx**2 + aby**2 < abzsquare:
            return

        # Discriminate left/right or up/down.
        # If significant movement in both planes the consider it a
        # oblique swipe (but only if any are configured)
        if abx > aby:
            motion = 'left' if x < 0 else 'right'
            if self.has_extended and abx > 0 and aby / abx > OBLIQUE_RATIO:
                motion += '_up' if y < 0 else '_down'
        else:
            motion = 'up' if y < 0 else 'down'
            if self.has_extended and aby > 0 and abx / aby > OBLIQUE_RATIO:
                motion = ('left_' if x < 0 else 'right_') + motion

        self.action(motion)

@add_gesture_handler
class PINCH(GESTURE):
    'Class to handle this type of gesture'
    SUPPORTED_MOTIONS = ('in', 'out', 'clockwise', 'anticlockwise')
    extended_text = 'clock'

    def update(self, coords):
        'Update this gesture for a motion'
        # Ignore this update if we can not parse the numbers we expect
        try:
            x = float(coords[4])
            y = float(coords[5])
        except (ValueError, IndexError):
            return False

        self.data[0] += x - 1.0
        self.data[1] += y
        return True

    def end(self):
        'Action this gesture at the end of a motion sequence'
        ratio, angle = self.data

        if self.has_extended and abs(angle) > ROTATE_ANGLE:
            self.action('clockwise' if angle >= 0.0 else 'anticlockwise')
        elif ratio != 0.0:
            self.action('in' if ratio <= 0.0 else 'out')

# Table of configuration commands
conf_commands = OrderedDict()

def add_conf_command(func):
    'Add configuration command to command lookup table based on name'
    conf_commands[re.sub('^conf_', '', func.__name__)] = func

@add_conf_command
def conf_gesture(lineargs):
    'Process a single gesture line in conf file'
    fields = lineargs.split(maxsplit=2)

    # Look for configured gesture. Sanity check the line.
    if len(fields) < 3:
        return 'Invalid gesture line - not enough fields'

    gesture, motion, command = fields
    handler = handlers.get(gesture.upper())

    if not handler:
        return 'Gesture "{}" is not supported.\nMust be "{}"'.format(
                gesture, '" or "'.join([h.lower() for h in handlers]))

    # Gesture command can be configured with optional specific finger
    # count so look for that
    fingers, *fcommand = command.split(maxsplit=1)
    if fingers.isdigit() and len(fingers) == 1:
        command = fcommand[0] if fcommand else ''
    else:
        fingers = None

    # Add the configured gesture
    return handler.add(motion.lower(), fingers, command)

@add_conf_command
def conf_device(lineargs):
    'Process a single device line in conf file'
    # Command line overrides configuration file
    if not args.device:
        args.device = lineargs

    return None if args.device else 'No device specified'

@add_conf_command
def swipe_threshold(lineargs):
    'Change swipe threshold'
    global swipe_min_threshold
    try:
        swipe_min_threshold = int(lineargs)
    except Exception:
        return 'Must be integer value'

    return None if swipe_min_threshold >= 0 else 'Must be >= 0'

@add_conf_command
def timeout(lineargs):
    'Change gesture timeout'
    global timeoutv
    try:
        timeoutv = float(lineargs)
    except Exception:
        return 'Must be float value'

    return None if timeoutv >= 0 else 'Must be >= 0'

def get_conf_line(line):
    'Process a single line in conf file'
    key, *argslist = line.split(maxsplit=1)

    # Old format conf files may have a ":" appended to the key
    key = key.rstrip(':')
    conf_func = conf_commands.get(key)

    if not conf_func:
        return 'Configuration command "{}" is not supported.\n' \
                'Must be "{}"'.format(key, '" or "'.join(conf_commands))

    return conf_func(argslist[0] if argslist else '')

def get_conf(conffile, confname):
    'Read given configuration file and store internal actions etc'
    with conffile.open() as fp:
        for num, line in enumerate(fp, 1):
            line = line.strip()
            if not line or line[0] == '#':
                continue

            errmsg = get_conf_line(line)
            if errmsg:
                sys.exit('Error at line {} in file {}:\n>> {} <<\n{}.'.format(
                    num, confname, line, errmsg))

def unexpanduser(cfile):
    'Return absolute path name, with $HOME replaced by ~'
    relslash = Path(os.path.abspath(str(cfile)))
    try:
        relhome = relslash.relative_to(os.getenv('HOME'))
    except (ValueError, TypeError):
        relhome = None

    return ('~/' + str(relhome)) if relhome else str(relslash)

# Search for configuration file. Use file given as command line
# argument, else look for file in search dir order.
def read_conf(conffile, defname):
    if conffile:
        confpath = Path(conffile)
        if not confpath.exists():
            sys.exit('Conf file "{}" does not exist.'.format(conffile))
    else:
        for confdir in CONFDIRS:
            confpath = Path(confdir, defname)
            if confpath.exists():
                break
        else:
            sys.exit('No file {} in {}.'.format(defname, ' or '.join(
                [unexpanduser(Path(c)) for c in CONFDIRS])))

    # Hide any personal user dir/names from diag output
    confname = unexpanduser(confpath)

    # Read and process the conf file
    get_conf(confpath, confname)
    return confname

def main():
    global args, abzsquare

    # Set up command line arguments
    opt = argparse.ArgumentParser(description=__doc__)
    opt.add_argument('-c', '--conffile',
            help='alternative configuration file')
    opt.add_argument('-v', '--verbose', action='store_true',
            help='output diagnostic messages')
    opt.add_argument('-d', '--debug', action='store_true',
            help='output diagnostic messages only, do not action gestures')
    opt.add_argument('-r', '--raw', action='store_true',
            help='output raw libinput debug-event messages only, '
            'do not action gestures')
    opt.add_argument('-l', '--list', action='store_true',
            help='just list out environment and configuration')
    opt.add_argument('--device',
            help='explicit device name to use (or path if starts with /)')
    # Test/diag hidden option to specify a file containing libinput list
    # device output to parse
    opt.add_argument('--device-list', help=argparse.SUPPRESS)
    args = opt.parse_args()

    if args.debug or args.raw or args.list:
        args.verbose = True

    # Libinput changed the way in which it's utilities are called
    libvers = get_libinput_vers()
    if not libvers:
        sys.exit('libinput helper tools do not seem to be installed?')

    if Version(libvers) >= Version('1.8'):
        cmd_debug_events = 'libinput debug-events'
        cmd_list_devices = 'libinput list-devices'
    else:
        cmd_debug_events = 'libinput-debug-events'
        cmd_list_devices = 'libinput-list-devices'

    if args.verbose:
        # Output various info/version info
        xsession = os.getenv('XDG_SESSION_DESKTOP') or \
                os.getenv('DESKTOP_SESSION') or 'unknown'
        xtype = os.getenv('XDG_SESSION_TYPE') or 'unknown'
        print('{}: session {}+{} on {}, python {}, libinput {}'.format(
            PROGNAME, xsession, xtype, platform.platform(),
            platform.python_version(), libvers))

        # Output hash version/checksum of this program
        vers = hashlib.md5(PROGPATH.read_bytes()).hexdigest()
        print('{}: hash {}'.format(PROGPATH, vers))

    # Read and process the conf file
    confname = read_conf(args.conffile, CONFNAME)

    # List out available gestures if that is asked for
    if args.verbose:
        if not args.raw:
            print('Gestures configured in {}:'.format(confname))
            for h in handlers.values():
                for mpair, cmd in h.motions.items():
                    motion, fingers = (mpair, '') \
                            if isinstance(mpair, str) else mpair
                    print('{} {:10}{:>2} {}'.format(h.name.lower(), motion,
                        fingers, cmd))

            if swipe_min_threshold:
                print('swipe_threshold {}'.format(swipe_min_threshold))
            if timeoutv != DEFAULT_TIMEOUT:
                print('timeout {}'.format(timeoutv))

        if args.device:
            print('device {}'.format(args.device))

    # Get touchpad device
    if not args.device or args.device.lower() != "all":
        device = get_device(args.device, cmd_list_devices, args.device_list)
        if not device:
            sys.exit('Could not determine touchpad device.')
    else:
        device = None

    if args.verbose:
        if device:
            print('{}: device {}'.format(PROGNAME, device.get('_diag')))
        else:
            print('{}: monitoring all devices'.format(PROGNAME))

    # If just called to list out above environment info then exit now
    if args.list:
        sys.exit()

    # Make sure only one instance running for current user
    user = getpass.getuser()
    proglock = open_lock(PROGNAME, user)
    if not proglock:
        sys.exit('{} is already running for {}, terminating ..'.format(
            PROGNAME, user))

    # Set up square of swipe threshold
    abzsquare = swipe_min_threshold**2

    # Note your must "sudo gpasswd -a $USER input" then reboot for
    # permission to access the device.
    devstr = ' --device {}'.format(device.get('_path')) if device else ''
    command = 'stdbuf -oL -- {}{}'.format(cmd_debug_events, devstr)

    cmd = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE,
            bufsize=1, universal_newlines=True)

    # Sit in a loop forever reading the libinput messages ..
    handler = None
    for line in cmd.stdout:

        # Just output raw messages if in that mode
        if args.raw:
            print(line.strip())
            continue

        # Only interested in gestures
        if 'GESTURE_' not in line:
            continue

        # Split received message line into relevant fields
        dev, gevent, time, other = line.strip().split(maxsplit=3)
        gesture, event = gevent[8:].split('_')
        fingers, *argslist = other.split(maxsplit=1)
        params = argslist[0] if argslist else ''

        # Action each type of event
        if event == 'UPDATE':
            if handler:
                # Split parameters into list of clean numbers
                if not handler.update(re.split(r'[^-.\d]+', params)):
                    print('Could not parse {} {}: {}'.format(gesture, event,
                        params), file=sys.stderr)

        elif event == 'BEGIN':
            handler = handlers.get(gesture)
            if handler:
                handler.begin(fingers)
            else:
                print('Unknown gesture received: {}.'.format(gesture),
                        file=sys.stderr)
        elif event == 'END':
            # Ignore gesture if final action is cancelled
            if handler:
                if params != 'cancelled':
                    handler.end()
                handler = None
        else:
            print('Unknown gesture + event received: {} + {}.'.format(gesture,
                event), file=sys.stderr)

if __name__ == '__main__':
    main()
07070100000009000081ED000003E800000064000000015F6B42E5000015ED000000000000000000000000000000000000002F00000000libinput-gestures-2.52/libinput-gestures-setup#!/bin/bash
# User setup script.
# (C) Mark Blakeney, Aug 2016.

PROG="$(basename $0)"
NAME=${PROG%-*}

BINDIR="/usr/bin"
APPDIR="/usr/share/applications"
ICOBAS="/usr/share/icons/hicolor"
ICODIR="$ICOBAS/128x128/apps"
OCODIR="/usr/share/pixmaps"
DOCDIR="/usr/share/doc/$NAME"
CNFDIR="/etc"
HCFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
AUTDIR="$HCFDIR/autostart"

usage() {
    echo "Usage:"
    echo "As root: sudo $PROG install|uninstall"
    echo "As user: $PROG start|stop|restart|autostart|autostop|status"
    echo
    echo "-d <dir> (option sets DESTDIR for install/uninstall)"
    echo "-r (force allow root to perform user commands. PLEASE AVOID USING THIS!)"
    exit 1
}

# Process command line options
DESTDIR=""
FORCEROOT=0
while getopts d:r c; do
    case $c in
    d) DESTDIR="$OPTARG";;
    r) FORCEROOT=1;;
    \?) usage;;
    esac
done

shift $((OPTIND - 1))

if [[ $# -ne 1 ]]; then
    usage
fi

cmd="$1"

# Launch given desktop app. First work out most suitable launcher.
# Pretty crude at present but should work for at least GNOME and KDE.
launch() {
    local app="$1"
    local fullpath="$APPDIR/$app.desktop"
    local binpath="$APPBIN/$app"

    # All the commands we will potentially try ..
    local cmds=(
	"kde kioclient5 exec $fullpath"
	"kde kioclient exec $fullpath"
	"all gtk-launch $app"
	"all i3-msg exec $binpath"
	"all exo-open $fullpath"
	"all dex $fullpath"
    )

    local cmdline
    for cmdline in "${cmds[@]}" ; do
	IFS=' ' read de cmd args <<< "$cmdline"

        # Skip if the command does not exist
	if ! hash $cmd &>/dev/null; then
	    continue
	fi

	# Only try KDE commands on KDE
	if ! echo $XDG_CURRENT_DESKTOP | grep -q KDE; then
	    if [[ $de == kde ]]; then
		continue
	    fi
	fi

	# Execute this command
	$cmd $args &>/dev/null
	return $?
    done

    echo "Don't know how to invoke $app.desktop" >&2
    return 1
}

# Set up desktop entry link for auto start of app, if it doesn't already
# exist
auto_start() {
    if [[ ! -f $APPDIR/$NAME.desktop ]]; then
	if [[ -e $AUTDIR/$NAME.desktop ]]; then
	    echo "Removed old $AUTDIR/$NAME.desktop"
	    rm -f $AUTDIR/$NAME.desktop
	fi
	return 1
    fi

    if ! cmp -s $APPDIR/$NAME.desktop $AUTDIR/$NAME.desktop; then
	if mkdir -p $AUTDIR && cp $APPDIR/$NAME.desktop $AUTDIR; then
	    echo "installed or updated $AUTDIR/$NAME.desktop"
	fi
    fi
    return 0
}

# Action given user command
user_action() {
    local cmd=$1

    if [[ $cmd == start ]]; then
	if [[ ! -f $APPDIR/$NAME.desktop ]]; then
	    echo "$NAME is not installed."
	    exit 1
	fi
	if launch "$NAME"; then
	    echo "$NAME started."
	fi
    elif [[ $cmd == stop ]]; then
	for prog in libinput-debug-events $NAME; do
	    if pkill -u $USER -f "$prog\$|$prog " &>/dev/null; then
		echo "$prog stopped."
	    fi
	done
    elif [[ $cmd == autostart ]]; then
	if ! auto_start; then
	    echo "$NAME is not installed."
	    exit 1
	fi
    elif [[ $cmd == autostop ]]; then
	rm -fv $AUTDIR/$NAME.desktop
    elif [[ $cmd == status ]]; then
	if [[ -f $APPDIR/$NAME.desktop ]]; then
	    echo "$NAME is installed."
	else
	    echo "$NAME is not installed."
	fi
	if [[ -f $AUTDIR/$NAME.desktop ]]; then
	    echo "$NAME is set to autostart."
	else
	    echo "$NAME is not set to autostart."
	fi
	if pgrep -u $USER -f "$NAME\$|$NAME " &>/dev/null; then
	    echo "$NAME is running."
	else
	    echo "$NAME is not running."
	fi
	if [[ -f $HCFDIR/$NAME.conf ]]; then
	    echo "$NAME is using custom configuration."
	else
	    echo "$NAME is using default configuration."
	fi
    else
	usage
    fi
}

if [[ $cmd == install || $cmd == uninstall ]]; then
    DESTDIR="${DESTDIR%%+(/)}"
    if [[ -z $DESTDIR && $(id -un) != root ]]; then
	echo "Install or uninstall must be run as sudo/root."
	exit 1
    fi

    # Remove any old files from earlier versions of program
    rm -f $DESTDIR$OCODIR/$NAME.png
    rm -f $DESTDIR$ICODIR/$NAME.png

    if [[ $cmd == install ]]; then
	install -CDv -m 755 -t $DESTDIR$BINDIR $NAME-setup
	install -CDv -m 755 -t $DESTDIR$BINDIR $NAME
	install -CDv -m 644 -t $DESTDIR$APPDIR $NAME.desktop
	install -CDv -m 644 -t $DESTDIR$ICODIR $NAME.svg
	install -CDv -m 644 -t $DESTDIR$CNFDIR $NAME.conf
	install -CDv -m 644 -t $DESTDIR$DOCDIR README.md
    else
	rm -rfv $DESTDIR$BINDIR/$NAME
	rm -rfv $DESTDIR$APPDIR/$NAME.desktop
	rm -rfv $DESTDIR$ICODIR/$NAME.svg
	rm -rfv $DESTDIR$CNFDIR/$NAME.conf
	rm -rfv $DESTDIR$DOCDIR
	rm -rfv $DESTDIR$BINDIR/$NAME-setup
    fi

    if [[ -z $DESTDIR ]]; then
	if [[ -x /usr/bin/update-desktop-database ]]; then
	    /usr/bin/update-desktop-database -q
	fi
	if [[ -x /usr/bin/gtk-update-icon-cache ]]; then
	    /usr/bin/gtk-update-icon-cache $ICOBAS
	fi
    fi
else
    if [[ $(id -un) == root && $FORCEROOT == 0 ]]; then
	echo "Non-installation commands must be run as your own user."
	exit 1
    fi

    # Remove any old configuration from earlier versions of program
    rm -fv ~/bin/$NAME 2>/dev/null
    rm -fv ~/.local/bin/$NAME 2>/dev/null
    rm -fv ~/.local/share/applications/$NAME.desktop 2>/dev/null
    rm -fv ~/.local/share/icons/$NAME.png 2>/dev/null

    # Look for and update any autostart file if it is a link or not
    # pointing to the latest desktop entry. Apparently user autostart
    # files should not be symlinks to system dir files.
    if [[ -e $AUTDIR/$NAME.desktop ]]; then
	if [[ -L $AUTDIR/$NAME.desktop ]]; then
	    echo "Removed old $AUTDIR/$NAME.desktop link"
	    rm -f $AUTDIR/$NAME.desktop
	fi
	auto_start
    fi

    if [[ $cmd == restart ]]; then
	user_action "stop"
	user_action "start"
    else
	user_action $cmd
    fi
fi

exit 0
0707010000000A000081A4000003E800000064000000015F6B42E5000020C5000000000000000000000000000000000000002E00000000libinput-gestures-2.52/libinput-gestures.conf# Configuration file for libinput-gestures.
# Mark Blakeney, Sep 2015
#
# The default configuration file exists at /etc/libinput-gestures.conf
# but a user can create a personal custom configuration file at
# ~/.config/libinput-gestures.conf.
#
# Lines starting with '#' and blank lines are ignored. Currently
# "gesture" and "device" configuration keywords are supported as
# described below. The keyword can optionally be appended with a ":" (to
# maintain compatibility with original format configuration files).
#
# Each gesture line has 3 [or 4] arguments separated by whitespace:
#
# action motion [finger_count] command
#
# where action and motion is either:
#     swipe up
#     swipe down
#     swipe left
#     swipe right
#     swipe left_up
#     swipe left_down
#     swipe right_up
#     swipe right_down
#     pinch in
#     pinch out
#     pinch clockwise
#     pinch anticlockwise
#
# command is the remainder of the line and is any valid shell command +
# arguments.
#
# finger_count is a single numeric digit and is optional (and is
# typically 3 or 4). If specified then the command is executed when
# exactly that number of fingers is used in the gesture. If not
# specified then the command is executed when that gesture is executed
# with any number of fingers. Gesture lines specified with finger_count
# have priority over the same gesture specified without any
# finger_count.
#
# Typically command will be xdotool, or wmctrl. See "man xdotool" for
# the many things you can action with that tool. Note that unfortunately
# xdotool does not work with native Wayland clients.

###############################################################################
# SWIPE GESTURES:
###############################################################################

# Note the default is an "internal" command that uses wmctrl to switch
# workspaces and, unlike xdotool, works on both Xorg and Wayland (via
# XWayland). It also can be configured for vertical and horizontal
# switching over tabular workspaces, as per the example below. You can
# also add "-w" to the internal command to allow wrapping workspaces.

# Move to next workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe up	_internal ws_up

# NOTE ABOUT FINGER COUNT:
# The above command will configure this command for all fingers (i.e. 3
# for 4) but to configure it for 3 fingers only, change it to:
# gesture swipe up	3 _internal ws_up
# Then you can configure something else for 4 fingers or leave 4 fingers
# unconfigured. You can configure an explicit finger count like this for
# all example commands in this configuration file.
#
# gesture swipe up	xdotool key super+Page_Down

# Move to prev workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe down	_internal ws_down
# gesture swipe down	xdotool key super+Page_Up

# Browser go forward (works only for Xorg, and Xwayland clients)
gesture swipe left	xdotool key alt+Right

# Browser go back (works only for Xorg, and Xwayland clients)
gesture swipe right	xdotool key alt+Left

# NOTE: If you don't use "natural" scrolling direction for your touchpad
# then you may want to swap the above default left/right and up/down
# configurations.

# Optional extended swipe gestures, e.g. for browser tab navigation:
#
# Jump to next open browser tab
# gesture swipe right_up xdotool key control+Tab
#
# Jump to previous open browser tab
# gesture swipe left_up xdotool key control+shift+Tab
#
# Close current browser tab
# gesture swipe left_down xdotool key control+w
#
# Reopen and jump to last closed browser tab
# gesture swipe right_down xdotool key control+shift+t

# Example of 8 static workspaces, e.g. using KDE virtual-desktops,
# arranged in 2 rows of 4 columns across using swipe up/down/left/right
# to navigate in fixed planes. You can also add the "-w/--wrap" option
# to allow wrapping in any direction. You must configure your virtual
# desktops with the same column dimension.
# gesture swipe up	_internal --cols 4 ws_up
# gesture swipe down	_internal --cols 4 ws_down
# gesture swipe left	_internal --cols 4 ws_left
# gesture swipe right	_internal --cols 4 ws_right
#
# Example of 16 static workspaces, e.g. using KDE virtual-desktops,
# arranged in 4 rows of 4 columns across using swipe up/down/left/right
# to navigate in fixed planes, and also using swipe
# left_up/left_down/right_up/right_down to navigate diagonally. You can
# also add the "-w/--wrap" option to allow wrapping in any direction
# and/or diagonally. You must configure your virtual desktops with the
# same column dimension.
# gesture swipe up		_internal --cols 4 ws_up
# gesture swipe down		_internal --cols 4 ws_down
# gesture swipe left		_internal --cols 4 ws_left
# gesture swipe right		_internal --cols 4 ws_right
# gesture swipe left_up		_internal --cols 4 ws_left_up
# gesture swipe left_down	_internal --cols 4 ws_left_down
# gesture swipe right_up	_internal --cols 4 ws_right_up
# gesture swipe right_down	_internal --cols 4 ws_right_down

# Example virtual desktop switching for Ubuntu Unity/Compiz. The
# _internal command does not work for Compiz but you can explicitly
# configure the swipe commands to work for a Compiz virtual 2
# dimensional desktop as follows:
# gesture swipe up	xdotool key ctrl+alt+Up
# gesture swipe down	xdotool key ctrl+alt+Down
# gesture swipe left	xdotool key ctrl+alt+Left
# gesture swipe right	xdotool key ctrl+alt+Right

# Example to change audio volume:
# Note this only works on an Xorg desktop (not Wayland).
# gesture swipe up   xdotool key XF86AudioRaiseVolume
# gesture swipe down xdotool key XF86AudioLowerVolume

###############################################################################
# PINCH GESTURES:
###############################################################################

# GNOME SHELL open/close overview (works for GNOME on Xorg only)
gesture pinch in	xdotool key super+s
gesture pinch out	xdotool key super+s

# KDE Plasma open/close overview
# gesture pinch in	xdotool key ctrl+F9
# gesture pinch out	xdotool key ctrl+F9

# GNOME SHELL open/close overview (works for GNOME on Wayland and Xorg)
# Note since GNOME 3.24 on Wayland this is implemented natively so no
# real point configuring for Wayland.
# gesture pinch in dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'
# gesture pinch out dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'

# Optional extended pinch gestures:
# gesture pinch clockwise <whatever command>
# gesture pinch anticlockwise <whatever command>

###############################################################################
# This application normally determines your touchpad device
# automatically. Some users may have multiple touchpads but by default
# we use only the first one found. However, you can choose to specify
# the explicit device name to use. Run "libinput list-devices" to work
# out the name of your device (from the "Device:" field). Then add a
# device line specifying that name, e.g:
#
# device DLL0665:01 06CB:76AD Touchpad
#
# If the device name starts with a '/' then it is instead considered as
# the explicit device path although since device paths can change
# through reboots this is best to be a symlink. E.g. instead of specifying
# /dev/input/event12, you should use the corresponding full path link
# under /dev/input/by-path/ or /dev/input/by-id/.
#
# You can choose to use ALL touchpad devices by setting the device name
# to "all". E.g. Do this if you have multiple touchpads which you want
# to use in parallel. This reduces performance slightly so only set this
# if you have to.
#
# device all

###############################################################################
# You can set a minimum travel distance threshold before swipe gestures
# are actioned using the swipe_threshold configuration command.
# Specify this value in dots. The default is 0.
# E.g. set it to 100 dots with "swipe_threshold 100".
# swipe_threshold 0

###############################################################################
# You can set a timeout on gestures from start to end. The default is
# the value commented below. It can be any value in float secs >= 0.
# 0 = no timeout. E.g. set it to 2 secs with "timeout 2".
# timeout 1.5
0707010000000B000081A4000003E800000064000000015F6B42E500000102000000000000000000000000000000000000003100000000libinput-gestures-2.52/libinput-gestures.desktop[Desktop Entry]
Type=Application
NoDisplay=true
Terminal=false
Name=Libinput Gestures
Exec=/usr/bin/libinput-gestures
Icon=libinput-gestures
Comment=Background application to intercept and action libinput gestures from touchpad.
Categories=GNOME;GTK;System;
0707010000000C000081A4000003E800000064000000015F6B42E50000412E000000000000000000000000000000000000002D00000000libinput-gestures-2.52/libinput-gestures.svg<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   inkscape:export-ydpi="90"
   inkscape:export-xdpi="90"
   inkscape:export-filename="/home/fatih/Documents/Github Stuff/libinput-gestures/libinput-gestures.png"
   width="128"
   height="128"
   viewBox="0 0 33.866666 33.866668"
   version="1.1"
   id="svg8"
   inkscape:version="1.1-dev (05e9e8ed4a, 2020-04-03)"
   sodipodi:docname="libinput-gestures.svg">
  <defs
     id="defs2">
    <linearGradient
       id="linearGradient887"
       inkscape:collect="always">
      <stop
         id="stop883"
         offset="0"
         style="stop-color:#3d3846;stop-opacity:1" />
      <stop
         id="stop885"
         offset="1"
         style="stop-color:#f6f5f4;stop-opacity:1" />
    </linearGradient>
    <linearGradient
       id="linearGradient4099">
      <stop
         id="stop1001"
         style="stop-color:#a7a7a7;stop-opacity:1"
         offset="0" />
      <stop
         id="stop1003"
         style="stop-color:#d1d1d1;stop-opacity:1"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient4633">
      <stop
         offset="0"
         style="stop-color:#333333;stop-opacity:0.43529412"
         id="stop4635" />
      <stop
         offset="1"
         style="stop-color:#444444;stop-opacity:0.54901963"
         id="stop4637" />
    </linearGradient>
    <linearGradient
       id="linearGradient4455">
      <stop
         id="stop4457"
         style="stop-color:#000000;stop-opacity:0.11728395"
         offset="0" />
      <stop
         id="stop4459"
         style="stop-color:#ffffff;stop-opacity:0"
         offset="0.05203352" />
      <stop
         id="stop4461"
         style="stop-color:#ffffff;stop-opacity:0.15686275"
         offset="0.96417594" />
      <stop
         id="stop4463"
         style="stop-color:#ffffff;stop-opacity:0.39215687"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient5048">
      <stop
         id="stop5050"
         style="stop-color:#000000;stop-opacity:0"
         offset="0" />
      <stop
         id="stop5056"
         style="stop-color:#000000;stop-opacity:1"
         offset="0.5" />
      <stop
         id="stop5052"
         style="stop-color:#000000;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient5060">
      <stop
         id="stop5062"
         style="stop-color:#000000;stop-opacity:1"
         offset="0" />
      <stop
         id="stop5064"
         style="stop-color:#000000;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient4099-7">
      <stop
         offset="0"
         style="stop-color:#c0bfbc;stop-opacity:1"
         id="stop4101" />
      <stop
         offset="1"
         style="stop-color:#f6f5f4;stop-opacity:1"
         id="stop4103" />
    </linearGradient>
    <linearGradient
       gradientTransform="matrix(0.03692506,0,0,0.03051161,0.4309538,289.04493)"
       gradientUnits="userSpaceOnUse"
       xlink:href="#linearGradient4633"
       id="linearGradient3102-8"
       y2="29.022623"
       x2="30.643436"
       y1="-17.850489"
       x1="30.643436" />
    <linearGradient
       x1="23.99999"
       y1="5.9748311"
       x2="23.99999"
       y2="41.781448"
       id="linearGradient3095-0-5"
       xlink:href="#linearGradient4455"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.04230545,0,0,0.03689171,0.11728308,288.34991)" />
    <linearGradient
       gradientTransform="matrix(1.4281595,0,0,1.5273373,-8.3434514,-9.7827539)"
       x1="18.927025"
       y1="43.996307"
       x2="18.387106"
       y2="8.4976816"
       id="linearGradient4097-5-3"
       xlink:href="#linearGradient4099-7"
       gradientUnits="userSpaceOnUse" />
    <radialGradient
       cx="605.71429"
       cy="486.64789"
       r="117.14286"
       fx="605.71429"
       fy="486.64789"
       id="radialGradient19613-0"
       xlink:href="#linearGradient5060"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(9.6716257e-4,0,0,4.9593175e-4,0.98238363,290.04092)" />
    <radialGradient
       cx="605.71429"
       cy="486.64789"
       r="117.14286"
       fx="605.71429"
       fy="486.64789"
       id="radialGradient19616-8"
       xlink:href="#linearGradient5060"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(-9.6716257e-4,0,0,4.9593175e-4,0.70323122,290.04092)" />
    <linearGradient
       x1="302.85715"
       y1="366.64789"
       x2="302.85715"
       y2="609.50507"
       id="linearGradient19619-1"
       xlink:href="#linearGradient5048"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.00299238,0,0,4.9593175e-4,-0.23872549,290.04095)" />
    <linearGradient
       gradientTransform="matrix(18.866877,0,0,28.265013,52.0008,-8160.5329)"
       gradientUnits="userSpaceOnUse"
       y2="289.43668"
       x2="-1.8258322"
       y1="290.25775"
       x1="-1.8256922"
       id="linearGradient889"
       xlink:href="#linearGradient887"
       inkscape:collect="always" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="2.102295"
     inkscape:cx="-38.730492"
     inkscape:cy="36.643361"
     inkscape:document-units="mm"
     inkscape:current-layer="layer3"
     showgrid="false"
     units="px" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       width="31.419514"
       height="27.492069"
       rx="0.67524314"
       ry="0.6752432"
       x="1.5027969"
       y="3.96417"
       id="rect1006"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient4097-5-3);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate" />
    <path
       d="m 1.5029651,24.923143 v 5.833516 c 0,0.386314 0.3113714,0.697916 0.6985774,0.697916 H 32.223193 c 0.38722,0 0.699107,-0.311602 0.699107,-0.697916 v -5.833516 z"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#b0afad;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
       id="rect1008" />
    <path
       d="m 1.5029698,23.110385 v 1.813122 H 32.922304 v -1.813122 z"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient889);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
       id="rect972" />
    <path
       d="m 1.5029651,24.923143 v 0.287913 H 32.922304 v -0.287913 z"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#deddda;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
       id="path967" />
    <path
       id="path1019"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#3d3846;stroke-width:0.264584;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate"
       d="m 1.5029651,24.923143 v 5.833516 c 0,0.386314 0.3113714,0.697916 0.6985774,0.697916 H 32.223193 c 0.38722,0 0.699107,-0.311602 0.699107,-0.697916 v -5.833516 z" />
    <path
       id="path891"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#77767b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
       d="m 1.5029651,30.38219 v 0.37538 c 0,0.386314 0.3113677,0.697916 0.6985774,0.697916 H 32.223193 c 0.38722,0 0.699107,-0.311602 0.699107,-0.697916 v -0.37538 c 0,0.386314 -0.311887,0.697916 -0.699107,0.697916 H 2.2015434 c -0.3872243,0 -0.6985774,-0.311602 -0.6985783,-0.697916 z" />
    <path
       id="rect907"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;marker:none;enable-background:accumulate"
       d="m 2.2015434,3.964723 c -0.3872243,0 -0.6985774,0.311602 -0.6985774,0.6979155 v 0.5503146 c 0,-0.3863136 0.311355,-0.6997377 0.6985774,-0.6997377 H 32.223193 c 0.387202,0 0.699107,0.3116019 0.699107,0.6997377 V 4.6626385 c 0,-0.3863135 -0.311905,-0.6979155 -0.699107,-0.6979155 z" />
    <rect
       style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#3d3846;stroke-width:0.264582;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate"
       id="rect1017"
       y="3.96417"
       x="1.5027969"
       ry="0.6752432"
       rx="0.67524314"
       height="27.492069"
       width="31.419514" />
    <g
       id="g921"
       transform="matrix(19.74871,0,0,18.861745,0.56819342,-5443.6074)"
       style="stroke-width:0.212278">
      <rect
         style="display:inline;overflow:visible;visibility:visible;opacity:0.3;fill:url(#linearGradient19619-1);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0137089;marker:none"
         id="rect2879"
         y="290.22278"
         x="0.12036061"
         height="0.12044057"
         width="1.4448938" />
      <path
         style="display:inline;overflow:visible;visibility:visible;opacity:0.3;fill:url(#radialGradient19616-8);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0137089;marker:none"
         id="path2881"
         d="m 0.12036056,290.22276 c 0,0 0,0.12043 0,0.12043 -0.0498065,2.3e-4 -0.120407817963,-0.027 -0.120407817963,-0.0602 0,-0.0332 0.05558029796,-0.0602 0.120407817963,-0.0602 z" />
      <path
         style="display:inline;overflow:visible;visibility:visible;opacity:0.3;fill:url(#radialGradient19613-0);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0137089;marker:none"
         id="path2883"
         d="m 1.5652544,290.22276 c 0,0 0,0.12043 0,0.12043 0.049806,2.3e-4 0.1204078,-0.027 0.1204078,-0.0602 0,-0.0332 -0.05558,-0.0602 -0.1204078,-0.0602 z" />
    </g>
    <path
       id="path1021"
       d="M 17.212638,31.457857 V 24.917831"
       style="fill:#3d3846;stroke:#3d3846;stroke-width:0.264584;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
  </g>
  <g
     inkscape:label="Layer 2"
     id="layer3"
     inkscape:groupmode="layer">
    <g
       transform="translate(7.9047907,1.4666454)"
       id="g1025">
      <path
         sodipodi:nodetypes="ccsscsscssscccsscccsssscc"
         id="path833"
         d="m 22.312587,9.1409407 c -1.056418,0 -1.913796,0.85645 -1.913796,1.9135283 V 9.7789047 c 0,-1.0568953 -0.857376,-1.915714 -1.913798,-1.915714 -1.05642,0 -1.913798,0.858272 -1.913798,1.915714 V 8.5033414 c 0,-1.0568955 -0.857376,-1.9157142 -1.913798,-1.9157142 -1.056419,0 -1.913798,0.8564498 -1.913798,1.9157142 V 6.9252871 c 0,-1.0568955 -0.857375,-1.915532 -1.913798,-1.915532 -1.0564186,0 -1.9137966,0.8564498 -1.9137966,1.915532 V 16.552876 L 4.1737922,14.53457 h -0.00397 c -0.2805783,-0.189512 -0.6251617,-0.280624 -0.995214,-0.280624 -1.0589894,0 -1.9137977,0.854628 -1.9137977,1.913528 0,0.371736 0.1020911,0.727071 0.2934248,1.020451 l -0.00234,-0.0049 5.8638081,8.561218 c 0.934003,1.490587 2.566993,2.39241 4.3237996,2.39241 h 6.107704 c 3.522491,0 6.379169,-2.856898 6.379169,-6.380004 V 11.057384 c 0,-1.0587173 -0.857376,-1.9137093 -1.91381,-1.9137093 z"
         inkscape:connector-curvature="0"
         style="fill:#b5835a;stroke-width:0.352298" />
      <path
         inkscape:connector-curvature="0"
         id="path870"
         d="m 1.5797803,15.110396 c -0.2001102,0.302491 -0.3199911,0.665116 -0.3199911,1.055074 0,0.371735 0.1022187,0.727071 0.2935451,1.02045 l 5.8629615,8.55484 c 0.9340026,1.490588 2.5670286,2.392593 4.3238342,2.392593 h 6.10626 c 3.522491,0 6.381293,-2.856169 6.381293,-6.379275 v -2.114885 c 0,3.523107 -2.858802,6.379276 -6.381293,6.379276 h -6.106259 c -1.7568046,0 -3.3898306,-0.903828 -4.3238347,-2.392593 z"
         style="fill:#986a44;stroke-width:0.352298" />
      <path
         inkscape:connector-curvature="0"
         id="path875"
         d="m 20.398813,10.618408 v 4.138111"
         style="fill:none;stroke:#63452c;stroke-width:0.264584px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
      <path
         inkscape:connector-curvature="0"
         id="path877"
         d="M 16.571216,9.5223347 V 14.259778"
         style="fill:none;stroke:#63452c;stroke-width:0.264584px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
      <path
         inkscape:connector-curvature="0"
         id="path879"
         d="M 12.74362,8.4745501 V 13.599218"
         style="fill:none;stroke:#63452c;stroke-width:0.264584px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" />
      <path
         id="path853"
         style="fill:#cdab8f;stroke-width:0.352298"
         d="m 10.830361,5.0101196 c -1.0564186,0 -1.9140946,0.8564498 -1.9140946,1.9149853 v 0.5794703 c 0,-1.0587178 0.857676,-1.9149853 1.9140946,-1.9149853 1.056423,0 1.913579,0.858272 1.913579,1.9149853 V 6.9251049 c 0,-1.0568955 -0.857157,-1.9149853 -1.913579,-1.9149853 z m 3.827674,1.5780543 c -1.056419,0 -1.914095,0.8564498 -1.914095,1.9155319 v 0.5794699 c 0,-1.0587173 0.857676,-1.9155315 1.914095,-1.9155315 1.056423,0 1.913579,0.858272 1.913579,1.9155315 V 8.5037058 c 0,-1.0568955 -0.857157,-1.9155319 -1.913579,-1.9155319 z m 3.827675,1.2755635 c -1.05642,0 -1.914096,0.858272 -1.914096,1.9155323 V 10.35874 c 0,-1.0568963 0.857676,-1.9155323 1.914096,-1.9155323 1.056421,0 1.913578,0.858272 1.913578,1.9155323 V 9.7792697 c 0,-1.0568958 -0.857156,-1.9155323 -1.913578,-1.9155323 z m 3.827157,1.2773853 c -1.056417,0 -1.913579,0.85645 -1.913579,1.9135283 v 0.57947 c 0,-1.056895 0.857157,-1.9135273 1.913579,-1.9135273 v 0.0026 c 1.056436,0 1.914094,0.8546273 1.914094,1.9135273 v -0.57947 c 0,-1.0587183 -0.857667,-1.9135273 -1.914094,-1.9135273 z M 3.1750136,14.253946 c -1.0589894,0 -1.9135788,0.854628 -1.9135788,1.913528 0,0.109334 0.00862,0.198623 0.023258,0.297024 0.1367958,-0.923872 0.9279242,-1.630899 1.8903244,-1.630899 0.3700523,0 0.7147122,0.09111 0.9952886,0.280624 h 0.00414 l 4.7418306,2.018488 v -0.57947 L 4.1744394,14.53457 h -0.00414 C 3.8897294,14.345058 3.5450695,14.253946 3.1750136,14.253946 Z" />
      <path
         style="fill:none;stroke:#63452c;stroke-width:0.264584;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
         inkscape:connector-curvature="0"
         d="m 22.312585,9.1409407 c -1.056418,0 -1.913794,0.85645 -1.913794,1.9135283 V 9.7789047 c 0,-1.0568953 -0.857376,-1.915714 -1.913799,-1.915714 -1.056419,0 -1.913797,0.858272 -1.913797,1.915714 V 8.5033414 c 0,-1.0568955 -0.857376,-1.9157142 -1.913798,-1.9157142 -1.05642,0 -1.913798,0.8564498 -1.913798,1.9157142 V 6.9252871 c 0,-1.0568955 -0.857375,-1.915532 -1.913798,-1.915532 -1.0564186,0 -1.9137976,0.8564498 -1.9137976,1.915532 V 16.552876 L 4.173792,14.53457 H 4.169822 C 3.8892437,14.345058 3.5446603,14.253946 3.174608,14.253946 c -1.0589894,0 -1.9137977,0.854628 -1.9137977,1.913528 0,0.371736 0.1020911,0.727071 0.2934248,1.020451 l -0.00234,-0.0049 5.8638081,8.561218 c 0.9340032,1.490587 2.5669932,2.39241 4.3237988,2.39241 h 6.107705 c 3.52249,0 6.379169,-2.856898 6.379169,-6.380004 V 11.057384 c 0.04411,-1.4596093 -1.233441,-1.9073323 -1.91379,-1.9137093 z"
         id="path820"
         sodipodi:nodetypes="ccsscsscssscccsscccssscc" />
    </g>
  </g>
</svg>
0707010000000D000081ED000003E800000064000000015F6B42E500000504000000000000000000000000000000000000002B00000000libinput-gestures-2.52/list-version-hashes#!/bin/bash
# M.Blakeney, Oct 2018.

PROG="$(basename $0)"
PROGDIR="$(dirname $0)"
SUMPROG="md5sum"

usage() {
    echo "Usage: $PROG [-options] [hashsum]"
    echo "Development utility to list version and hash sums, and flag those that"
    echo "match given hash sum. Must be run from the libinput-gestures git repo dir."
    echo "Options: (none)"
    exit 1
}

# Process command line options
while getopts \? c; do
    case $c in
    \?) usage;;
    esac
done

shift $((OPTIND - 1))

if [[ $# -eq 1 ]]; then
    HASHSUM="$1"
elif [[ $# -ne 0 ]]; then
    usage
else
    HASHSUM=""
fi

output() {
    local tag=$1
    local hashsum=${2/ */}

    if [[ -n $HASHSUM && $HASHSUM == $hashsum ]]; then
	found=" *"
    else
	found=""
    fi

    printf "%-24s %s%s\n" $tag $hashsum "$found"
}

cd ${PROGDIR:-.} || exit 1

# Iterate through all tags and output the md5 hash for each version
tag=""
while read hashc; do
    tag=$(git describe --tags --always $hashc)
    hashsum=$(git show $hashc:libinput-gestures | $SUMPROG)
    output $tag $hashsum
done <<< "$(git rev-list --all --reverse)"

# Output a version for the working tree as well
tagw=$(git describe --tags --always --dirty)
if [[ $tagw != $tag ]]; then
    hashsum=$($SUMPROG libinput-gestures)
    output $tagw $hashsum
fi
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!178 blocks
openSUSE Build Service is sponsored by