lillinput
is a small utility written in Rust for connecting libinput
gestures into:
- commands for the
i3
tiling window manager IPC interface - shell commands
Please be aware that this project is in beta, and was started for scratching
a specific itch - allowing three-finger swipe for changing between workspaces
in i3
under a personal setup. It aims to stay small (hence the name) and
biased towards custom needs (and a bit of a Rust playground).
Upon invocation, lillinput
will listen to libinput
events until stopped. By
default, the i3
action will be enabled, with the workspace next
configured
for the "three finger right swipe" gesture, and the workspace prev
for the
"three finger left swipe" gesture.
The full list of options can be retrieved via:
$ lillinput --help
...
USAGE:
lillinput [OPTIONS]
OPTIONS:
-c, --config-file <CONFIG_FILE>
Configuration file
-e, --enabled-action-types <ENABLED_ACTION_TYPES>...
enabled action types [possible values: i3, command]
--four-finger-swipe-down <FOUR_FINGER_SWIPE_DOWN>...
actions the four-finger swipe down
--four-finger-swipe-left <FOUR_FINGER_SWIPE_LEFT>...
actions the four-finger swipe left
--four-finger-swipe-right <FOUR_FINGER_SWIPE_RIGHT>...
actions the four-finger swipe right
--four-finger-up-down <FOUR_FINGER_UP_DOWN>...
actions the four-finger swipe up
-h, --help
Print help information
-s, --seat <SEAT>
libinput seat
-t, --threshold <THRESHOLD>
minimum threshold for displacement changes
--three-finger-swipe-down <THREE_FINGER_SWIPE_DOWN>...
actions the three-finger swipe down
--three-finger-swipe-left <THREE_FINGER_SWIPE_LEFT>...
actions the three-finger swipe left
--three-finger-swipe-right <THREE_FINGER_SWIPE_RIGHT>...
actions the three-finger swipe right
--three-finger-swipe-up <THREE_FINGER_SWIPE_UP>...
actions the three-finger swipe up
-v, --verbose
Level of verbosity (additive, can be used up to 3 times)
-V, --version
Print version information
Each --{number}-finger-swipe-{direction}
argument accepts one or several
"actions", in the form {type}:{command}
. For example, the following
invocation specifies two actions for the "three finger swipe up": moving to the
next workspace in i3
, and creating a file.
$ lillinput --three-finger-swipe-up "i3:workspace next" --three-finger-swipe-up "command:touch /tmp/myfile"
Currently, the available action types are i3
and command
.
The configuration from the application can be read from a configuration file. By default, the following sources will be read in order:
/etc/lillinput.toml
${XDG_HOME}/lillinput/lillinput.toml
${CWD}/lillinput.toml
Alternatively, a different file can be specified via the --config-file
argument. If specified, any other command line arguments will take precedence
over values read from the configuration file.
The format of the configuration can be found in the sample configuration file:
verbose = 0
seat = "seat01"
threshold = 20.0
enabled_action_types = ["i3"]
[actions]
three-finger-swipe-right = ["i3:workspace next"]
three-finger-swipe-left = ["i3:workspace prev"]
three-finger-swipe-up = []
three-finger-swipe-down = []
four-finger-swipe-right = []
four-finger-swipe-left = []
four-finger-swipe-up = []
four-finger-swipe-down = []
The following system-level libraries are required by this crate dependencies:
sudo aptitude install libudev-dev libinput-dev
This create relies heavily on the wonderful work on the input
and i3ipc
crates (among others) - kudos to their maintainers for making them available.
Outside rust, the following projects provide a more complete solution for using
libinput
gestures:
Any contribution is welcome, please issue or PR away!
This project is licensed under BSD-3-Clause.