Setting up Fusuma — Blessing for Touchpad Ubuntu Users
Fusuma is an application created in Ruby, that enables Ubuntu users to map the touch gestures on their trackpad, to some action to be done on Ubuntu GUI desktop.
That’s a perfect thing to enable gestures in Linux machine — same like what we were familiar to use in high end Windows or Mac laptops.
if you can pull out, two swipes at once, it would give a super fancy animation to open start menu (I am using Ubuntu 21.10).
Installing Fusuma
- Add input to current user group. (so it could work without sudo, or entering password). To see in which “groups the user is” refer Extra1
- Install libinput-tools (to fetch data from input devices). refer Extra2
- Install xdotool (to simulate keyboard and mouse inputs, click, type etc). refer Extra3
$ sudo gpasswd -a $USER input
$ sudo apt-get install libinput-tools
$ sudo apt-get install xdotool(Extra1) To see, in which groups the user is present
$ groups $USER
vinay : vinay adm cdrom sudo dip plugdev input lpadmin lxd(Extra2) To see, how libinput works
$ libinput debug-gui # a GUI to test cursor, keyboard
$ libinput debug-events # to view what moving a mouse really means(Extra3) To play with xdotool
$ xdotool key h+e+l+o # simulating hello world
4. Now have to install ruby (skip if you have that)
5. After ruby, lets install our hero ‘fusuma’
$ sudo apt install ruby
$ sudo gem install fusuma
6. Everything is ready (hopefully, if you have followed), just need to map gestures from libinput to perform simulations via xdotool — that’s it. Create folder fusuma inside .config in home (yup, its a hidden folder). In fusuma folder create file config.yml - open it with your favourite editor
$ subl ~/.config/fusuma/config.yml
# if you use nano, replace subl, I use sublime its great
7. Enter the following gibberish into the newly created yml file (yet another markup language) and save it — Hopefully you don’t blindly copy this one, now you should be able to understand what all is written.
if swipe with 3 fingers, in left direction — simulate alt+Right using xdotool and so on.
swipe:
3:
left:
command: 'xdotool key alt+Right' #browser next
right:
command: 'xdotool key alt+Left' #browser back
up:
command: 'xdotool key super' #super
down:
command: 'xdotool key super' #super
4:
left:
command: 'xdotool key ctrl+alt+Right' #desktop change
right:
command: 'xdotool key ctrl+alt+Left' #desktop change
up:
command: 'xdotool key super+d' #show desktop
down:
command: 'xdotool key super+d' #show desktop
pinch:
in:
command: 'xdotool key ctrl+plus'
out:
command: 'xdotool key ctrl+minus'threshold:
swipe: 0.4
pinch: 0.4interval:
swipe: 0.8
pinch: 0.1
8. Type fusuma in your terminal, and try your gestures. You should be able to see some logs. Keep playing and modifying yml file as per your requirements.
9. Once ready, hit search, type “startup applications”, click Add, Enter following details. Done, now you can restart your system and fusuma will be running in background.
If you change anything in config, just kill fusuma by “pkill fusuma” and start again by fusuma.
Enjoy Fusuma and your trackpad to become more productive !!
I write blogs (or can say Notes) for myself, just so I can refer them again in future. I try to keep it in a format that would be easy to implement step by step. My blogs can be helpful to others in same position as me, so I am making those public. Hope it helped you, if not write your query in comments will together fix that issue :P