Giter Site home page Giter Site logo

lillinput's Introduction

lillinput

crates.io license build status

About

lillinput is a small utility written in Rust for connecting libinput gestures into:

  • commands for the i3 tiling window manager IPC interface
  • shell commands

Project status

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).

Usage

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

Configuring the swipe actions

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.

Using a configuration file

The configuration from the application can be read from a configuration file. By default, the following sources will be read in order:

  1. /etc/lillinput.toml
  2. ${XDG_HOME}/lillinput/lillinput.toml
  3. ${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 = []

Compiling

Dependencies

The following system-level libraries are required by this crate dependencies:

sudo aptitude install libudev-dev libinput-dev

Related projects

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:

Contributing

Any contribution is welcome, please issue or PR away!

License

This project is licensed under BSD-3-Clause.

lillinput's People

Contributors

diego-plan9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.