Using Lisgd And I3 On A Convertible Laptop
August 2021
I3 is a good Window manager for laptops because it does not rely on your touchpad. When I got a new convertible laptop I still wanted to use I3 because it is so powerful if the convertible is in Laptop mode. There was only one problem: I3 has absolutly no touch support.
Using a touch friendly config for polybar which implements a launcher as well as control buttons for closing or moving windows makes I3 somewhat more usable, but it still feels somewhat clumsy. Even my polybar config was still to slow. The solution to this is enabling touch-gestures for frequently used functions.
Lisgd is a programm that recognizes multi-touch gestures and executes commands based on those gestures.
Lisgd is part of the SXMO enviroment which is beeing developed for the Pinephone but it should also work for laptop screens.
Gestures in Lisgd are triggered along the screen edges. Gestures can be detected at any of the screen edges or on a specific edge or corner. Currently only swipes in one of 8 directions are supported. Each gesture trigges a simple command. Gestures can trigger commands multiple times while swiping(for example to set the volume) or once per swipe.
Table of contents
The following guide was tested on Arch Linux.
Installing
Arch Linux
You can simply install lisgd from the AUR
yay -S lisgd
Compiling from source
You can also build it directly from source:
git clone https://git.sr.ht/~mil/lisgd
cd lisgd
sudo make install
Configuring Udev
Before we can use lisgd we will need to create a udev rule that detects our touchscreen and sets the apropriate permissions. Create the file /etc/udev/rules.d/99-lisgd-device.rules, add the following line to it and restart your computer. Make sure to change USERNAME to your username.
ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-20]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", MODE:="0666" GROUP="USERNAME", SYMLINK+="input/touchscreen"
Configuring lisgd
Lisgd is either configured using commandline options or using config.h. Config.h is included in the programm during compiling so you will need to recompile your programm if you want to use config.h.
Gestures are defined using the -g option:
sudo lisgd -g '1,LR,*,*,R,echo test'
if you run this and swipe from left to right with one finger you should see “test” printed in your console.
using the -g option multiple times lets you specify more than one gesture:
lisgd -g '1,LR,*,*,R,echo swiped left to right' -g '2,UD,T,*,R,echo swiped down from top with two fingers'
The options are:
fingercount,direction,edge,distance,trigger on release or multiple times(actmode), command to execute
Direction: LR,RL,DU,UD,DLUR,URDL,ULDR,DLUR (read: left to right, downleft to upright )
edge: * (any), N (none), L (left), R (right), T (top), B (bottom), TL (top left), TR (top right), BL (bottom left), BR (bottom right)
Distance: * (any), S (short), M (medium), L (large)
actmode: R (release), P (pressed)
Use the -m option to set the timeout in ms
use the -t/-T option to set the distance needed to trigger a gesture
-o is used for rotating the screen
For more info refer to https://git.sr.ht/~mil/lisgd
My configuration
This is my configuration:
lisgd -m 1000 -t 40 -T 40 -g '2,LR,*,*,R,xdotool key Super+Shift+Right' -g '2,RL,*,*,R,xdotool key Super+Shift+Left' -g '2,UD,*,*,R,xdotool key Super+Shift+q' -g '3,LR,*,*,R,python move_to_right_workspace.py' -g '3,RL,*,*,R,python move_to_left_workspace.py' -g '1,DRUL,*,*,R,xdotool key Super+w' -g '1,ULDR,*,*,R,xdotool key Super+e'
This config uses two python scripts that move windows to the next/previous workspace and xdotool for all other actions. If you mapped the actions to different key combinations you will need do change the buttons xdotool sends.
For rotation of the screen i simply have the following lines in the scripts I use to rotate the screen(replace the 3 with the number corresponding to the correct rotation).
killall lisgd
lisgd -o 3 REST_OF_THE_PARAMETERS