Forked from https://github.com/Coffee2CodeNL/gebaar-libinput since original repo has been unmaintained for over a year, yet this is NOT OFFICIAL repo!
This fork merges the following into Gebaar
- https://github.com/gabrielstedman/gebaar-libinput adding touch support and pinch in/out gestures
- Coffee2CodeNL#25 adding error catching when parsing options
Other changes include:
- Allowing different commands to be run depending on touchpad or touchscreen gestures
- Adding support to run commands on switch events for 2 in 1 laptops
- Adding support for pinch and rotate gestures
- Improve configuration specificity and options
- And various miscellaneous changes
WM Independent Touchpad Gesture Daemon for libinput
Gebaar means Gesture in Dutch
Run any command by simply gesturing on your touchpad!
libinput-gestures and fusuma both parse the output of the shell command libinput debug-events
which is an unstable API and the output just keeps coming, so it'll eat (some) RAM.
Gebaar directly interfaces with libinput to receive and react to the events.
This is more stable, faster, and more efficient as it does not parse the output of a program like the aforementioned projects do.
- Clone the repository via
git clone https://github.com/NICHOLAS85/gebaar-libinput
- Run
git submodule update --init
in the root folder - Run
mkdir build && cd build
- Run
cmake ..
- Run
make -j$(nproc)
- Run
sudo make install
to install - Run
mkdir -p ~/.config/gebaar
- Run
nano ~/.config/gebaar/gebaard.toml
(or vim, if you like it better) - Add the snippet below to
gebaard.toml
- Configure commands to run per direction
- Add yourself to the
input
group withusermod -a -G input $USER
- Run Gebaar via some startup file by adding
gebaard -b
to it - Reboot and see the magic
[[swipe.commands]]
fingers = integer (default 3)
type = string (TOUCH|GESTURE) (default GESTURE)
# Entries below run string based on direction
left_up = string
right_up = string
up = string
left_down = string
right_down = string
down = string
left = string
right = string
[[pinch.commands]]
fingers = integer (default 2)
type = string (ONESHOT|CONTINUOUS) (default ONESHOT)
# Entries below run string based on direction
in = string
out = string
rotate_left = string
rotate_right = string
[switch.commands]
# Entries below run string when 2 in 1 devices switch modes
laptop = string
tablet = string
[settings]
pinch.threshold = double (default 0.25)
rotate.threshold = double (default 20)
interact.type = string (TOUCH|GESTURE|BOTH) (default automatic)
gesture_swipe.threshold = double (default 0.5)
gesture_swipe.one_shot = bool (default true)
gesture_swipe.trigger_on_release = bool (default true)
touch_swipe.longswipe_screen_percentage = double (default 70)
swipe.commands.type
key determines whether gestures in current array are triggered by touchscreen (TOUCH) or trackpad (GESTURE) gestures.pinch.commands.type
key determines if a pinch is triggered once (ONESHOT) or continuously (CONTINUOUS) as fingers get closer or farther apart.settings.pinch.threshold
key sets the distance between fingers where it should trigger. Defaults to0.25
which means fingers should travel exactly 25% distance from their initial position.settings.rotate.threshold
key sets angle between fingers where it should trigger. Defaults to20
which means fingers must travel 20 degrees from their initial position.interact.type
key determines whether touchscreen (TOUCH) or trackpad (GESTURE) gestures are detected. In 2 and 1 devices, this key is set automatically depending on what mode the device is currently in, BOTH supersedes this behavior.settings.gesture_swipe.threshold
sets the percentage fingers should travel to trigger a swipe.settings.gesture_swipe.one_shot
key determines whether gestures are triggered once (ONESHOT) or continuously (CONTINOUS) as fingers travel across the trackpad.settings.touch_swipe.longswipe_screen_percentage
key determines percentage of a screen dimension a swipe must cover to be interpreted as a longswipe. Only for 'fingers = 1'.
bspwm
~/.config/gebaar/gebaard.toml
[[swipe.commands]]
fingers = 3
left_up = ""
right_up = ""
up = "bspc node -f north"
left_down = ""
right_down = ""
down = "bspc node -f south"
left = "bspc node -f west"
right = "bspc node -f east"
[[swipe.commands]]
fingers = 4
left_up = ""
right_up = ""
up = "rofi -show combi"
left_down = ""
right_down = ""
down = ""
left = "bspc desktop -f prev"
right = "bspc desktop -f next"
[[swipe.commands]]
fingers = 1
left_up = ""
right_up = ""
up = ""
left_down = ""
right_down = ""
down = "echo long_swipe_down"
left = ""
right = ""
[pinch.commands]
type = "ONESHOT"
in = "xdotool key Control_L+equal"
out = "xdotool key Control_L+minus"
[settings.pinch]
threshold=0.25
[settings.gesture_swipe]
threshold = 0.5
one_shot = true
trigger_on_release = false
[settings.touch_swipe]
longswipe_screen_percentage = 95
Add gebaard -b
to ~/.config/bspwm/bspwmrc
kde
~/.config/gebaar/gebaard.toml
[[swipe.commands]]
up = "~/bin/presentview --up"
down = "~/bin/presentview --down"
left = "xdotool key alt+Right"
right = "xdotool key alt+Left"
[[swipe.commands]]
fingers = 4
up = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Maximize"'
down = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "MinimizeAll"'
left = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Quick Tile Left"'
right = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Quick Tile Right"'
[[swipe.commands]]
fingers = 2
type = "TOUCH"
up = "dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.ToggleVisible"
left = "xdotool key alt+Right"
right = "xdotool key alt+Left"
[[swipe.commands]]
type = "TOUCH"
up = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Expose"'
down = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Minimize"'
[[swipe.commands]]
fingers = 4
type = "TOUCH"
up = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Maximize"'
down = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "MinimizeAll"'
left = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Quick Tile Left"'
right = 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Quick Tile Right"'
[[pinch.commands]]
type = "ONESHOT"
in = "~/bin/firefoxorbust"
out = "xdotool key ctrl+shift+t"
[[pinch.commands]]
type = "CONTINUOUS"
rotate_left = 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"'
rotate_right = 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"'
[[switch.commands]]
laptop = "pkill onboard; pkill screenrotator;"
tablet = "onboard & screenrotator &"
[settings]
pinch.threshold = 0.13
rotate.threshold = 20
interact.type = "BOTH"
[settings.gesture_swipe]
threshold = 0.7
trigger_on_release = false
Starting and managing Gebaar with Systemd
Move the file assets/gebaard.service
to ~/.config/systemd/user/
:
$ mkdir --parents ~/.config/systemd/user
$ cp assets/gebaard.service ~/.config/systemd/user
Once the file is in place simply enable the unit to run Gebaar automatically on startup.
$ systemctl --user --now enable gebaard.service
If you would like Gebaar to restart automatically when it's configuration file is modified move assets/gebaard-watcher.path
and assets/gebaard-watcher.service
to ~/.config/systemd/user
$ cp assets/gebaard-watcher.path ~/.config/systemd/user
$ cp assets/gebaard-watcher.service ~/.config/systemd/user
Once the files are in place, simply enable the path watcher to have Gebaar restart whenever ~/.config/gebaar/gebaard.toml
is edited:
$ systemctl --user enable gebaard-watcher.path
- Receiving swipe events from libinput
- Swipe gesture have trigger threshold
- Receiving pinch/zoom events from libinput
- Support continuous pinch
- Support pinch-and-rotate gestures
- Support touchscreen devices
- Adjust touch gestures based on orientation
- Receiving switch events from libinput
- Converting libinput events to motions
- Running commands based on motions
- Refactor code to be up to Release standards, instead of testing-hell