DEV Community

Cover image for How to customize touchpad gestures on Linux using Fusuma
Kohei Yamada
Kohei Yamada

Posted on • Updated on

How to customize touchpad gestures on Linux using Fusuma

I published "Fusuma" to RubyGems that recognize swipe or pinch gesture on Linux touchpad.
https://github.com/iberianpig/fusuma

You can add touchpad gestures to run commands or common tasks, such as changing workspaces, back or forward on a browser, etc.

This my first post is how to use and customize Fusuma.

Install Fusuma

If you use Debian-based OS (using apt for package management), you can use the following commands like "apt install" as they are.

I'm using fusuma on elementary OS Loki on Dell XPS 13(9360).

You can use libinput that depends on Fusuma for Ubuntu 15.04 and above, but you should try xswipe to use the Synaptics driver for older versions' Ubuntu.

Confirm installed Ruby version

Please confirm at first whether you have ruby installed.

You can use the fusuma with Ruby it installed in System Wide.

(Of course, even rbenv and rvm is OK)

$ ruby -v

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
# confirm the version of ruby installed
Enter fullscreen mode Exit fullscreen mode

Install dependent packages

Install libinput-tools for reading touchpad input.

(Fusuma use the output of debug logs by libinput debug-events in itself)

$ sudo apt install libinput-tools
Enter fullscreen mode Exit fullscreen mode

Also install xdotool so that fusuma trigger shortcuts such as Alt + Left, Alt + Right and so on.

$ sudo apt install xdotool
Enter fullscreen mode Exit fullscreen mode

Install Fusuma From RubyGems

$ sudo gem i fusuma
Enter fullscreen mode Exit fullscreen mode

i is an abbreviation for install. If you want to install the fusuma to Ruby in System-Wide is required sudo.

(If you use the Ruby you have installed via rbenv and rvm, you can install with $ gem install fusuma)

Create configurations file for Fusuma

Create a configurations file to ~/.config/fusuma/config.yml

$ mkdir -p ~/.config/fusuma
$ touch ~/.config/fusuma/config.yml
Enter fullscreen mode Exit fullscreen mode

Open ~/.config/fusuma/config.yml in editor, then paste following content.

swipe:
  3:
    left:
      command: 'xdotool key alt+Right'
    right:
      command: 'xdotool key alt+Left'
    up:
      command: 'xdotool key ctrl+t'
    down:
      command: 'xdotool key ctrl+w'
Enter fullscreen mode Exit fullscreen mode

The above example is registering the shortcut of the browser by three fingers' swipe.
(Back / Forward / Create Tab / Close Tab)

Add the user to input groups

To execute Fusuma, it needs to give permission to read to the input of touchpad to the user.

$ sudo gpasswd -a $USER input
Enter fullscreen mode Exit fullscreen mode

gpasswd command adds the user to the input group.
($ USER is the username at runtime)

Need to log out and log in (or restart) from X

Fusuma cannot recognize the touchpad without this process.
Because it must be reflected to add the user in the input group.

Launch Fusuma

Open terminal, and type Fusuma and endter.

$ fusuma
Enter fullscreen mode Exit fullscreen mode

It's OK if all actions are worked (Back / Forward / Create Tab / Close Tab) when you swipe with Three-finger on the browser.

Keep running in the background when the terminal is closed

$ fusuma -d
Enter fullscreen mode Exit fullscreen mode

This -d option is running as Unix demon, it disconnects from the terminal process.
So fusuma is available even after closing terminal.

Configure commands to be assigned gesture

Add recognition gestures and assigns commands to it in ~/.config/fusuma/config.yml.

Confirm command to run in terminal

To switch the workspace, you can set xdotool key ctrl + alt + Up orxdotool key ctrl + alt + Down
I recommend that you try such commands to work properly on the terminal.

Shortcuts for workspace depend on the WindowManager in this example. (Gnome 3 moves up and down with xdotool key ctrl + alt + Up andxdotool key ctrl + alt + Down)

Switch the workspace in the four fingers' swipe

Paste the following at the bottom of the swipe section

  4:
    up: 
      command: 'xdotool key ctrl+alt+Down'
    down: 
      command: 'xdotool key ctrl+alt+Up'
Enter fullscreen mode Exit fullscreen mode

If you rewrite the config file, you must do re-run fusuma command after it stops with Ctrl-c or kill command.

If you can confirm the operation of the customized four-finger swipe, it is OK.

Autostart setting of Fusuma

Set fusuma to start automatically, because it is troublesome to open the terminal and execute Fusuma command with every restarts your laptop.

  1. Enter the which fusuma in the terminal, to note the path to launch Fusuma

  2. Start gnome-session-properties, enter the launch path noted the previous step by adding the -d options (daemonize) at the end.

Update Fusuma

$ sudo gem update fusuma
Enter fullscreen mode Exit fullscreen mode

(If you have installed fusuma with Ruby on rbenv or rvm, you can update with $ gem update fusuma)

Other customizations

In ~/.config/fusuma/config.yml, you can set Pinch Zoom (pinch in / pinch out) and Sensitivity for each gesture(threshold).
It is also possible to set gestures that pinch in continuity.

See Fusuma repository README for more information.

When finding a bug

If you find any bug or issue, please register the issue to Github Issue.

Donation

Do you want to support Fusuma? Check out the fully optional donation option, a way to support Fusuma's ongoing development directly: https://github.com/sponsors/iberianpig

Top comments (1)

Collapse
 
maestromac profile image
Mac Siri

I just switched from MacOS to Ubuntu. This tool is such a big help, thank you for making this!!