Starting from this article, I will explain how to configure the new features available in Fusuma v2.
If you haven't updated to Fusuma v2, please refer to the previous article.
Fusuma, multi-touch gestures for Linux, updated to v2!
Kohei Yamada ・ Jun 9 '21
So far, Fusuma has only allowed you to set one type of action for a gesture globally.
However, by using the context of Fusuma v2, you will be able to switch Config dynamically.
In this article, we will install fusuma-plugin-appmatcher
and configure application-specific settings on Fusuma's config.yml.
iberianpig / fusuma-plugin-appmatcher
Fusuma plugin configure app-specific gestures
Fusuma::Plugin::Appmatcher
Fusuma plugin configure app-specific gestures
- Switch gesture mappings by detecting active application.
- Support X11, Ubuntu-Wayland
Installation
Run the following code in your terminal.
Install fusuma-plugin-appmatcher
$ sudo gem install fusuma-plugin-appmatcher
Install Appmatcher GNOME Shell Extensions on Wayland
Gnome Wayland version 41 and later does not allow to access information about window or application like focused app So fusuma-plugin-appmatcher solves this problem via Appmatcher gnome-extension.
$ fusuma-appmatcher --install-gnome-extension
Restart your session(logout/login), then activate Appmatcher on gnome-extensions-app
List Running Application names
$ fusuma-appmatcher -l
prints Running Application names.
$ fusuma-appmatcher -l
Slack
Google-chrome
Alacritty
You can use these applicatin name to under application:
context in config.yml
Add appmatcher properties and application names to config.yml
-
Add the
---
symbol to separate the context in config.yml. -
Add
context:
property in~/.config/fusuma/config.yml
. -
Under the
context:
property, you can set theapplication: APP_NAME
as a value.
- In this context, you can configure mappings to…
Install fusuma-plugin-appmatcher
Run the following command in a terminal
$ sudo gem install fusuma-plugin-appmatcher
How to configure fusuma-plugin-appmather
Get the application name to use in the configuration.
To get application name (WM_CLASS) to specify in config.yml, use $ fusuma-appmatcher -l
.
Without -l
option, only foreground application names are retrieved.
$ fusuma-appmatcher -l
discord
Slack
Gnome-terminal
Google-chrome
Set context: WM_CLASS
in config.yml.
To add to the existing config.yml.
- add
---
to the bottom of~/.config/fusuma/config.yml
to separatecontext
. - add
context: { application: Google-chrome }
. - add
swipe: ... ...
and describe the gestures as usual.
In the following example, 4-finger gesture is the default setting, and 3-finger swipe gesture is assigned with different behaviors for Google Chrome and Gnome Terminal.
This example uses fusuma-plugin-wmctrl , fusuma-plugin-sendkey and fusuma-plugin-keypress .
When I try swiping up three fingers on Google Chrome and Gnome Terminal respectively, both tabs open.
I was able to assign different keys to them: LEFTCTRL+T
for Google Chrome and LEFTSHIFT+LEFTCTRL+T
for Gnome Terminal.
Concept of Context in Fusuma v2
Actually, Fusuma runs as an event-driven application.
When a user touches the trackpad, some touch events will be sent to Fusuma. Fusuma will calculate the events and if they exceed the threshold, it will pass them to the executor plugin as swipe events and execute the action associated with the event content from config.yml.
Fusuma will search the config.yml for actions that match the event, but when a context event is issued, Fusuma will search the config for actions that match that context.
- Fusuma v2 can accept YAML documents containing
---
. - You can create a context by separating the config.yml with three
---
hyphens. - The first document delimited by
---
is treated as the default configuration. - By the way,
---
is a standard YAML syntax that allows multiple documents to be described in one file.
Under context:
is the event-name of the context and its value.
context:
event-name: value
swipe:
3:
left:
sendkey: 'LEFTALT+RIGHT'
Currently, context events can only be fired by the fusuma-plugin-appmatcher plugin.
In the future, we plan to support context events from tail or external commands by generalizing the events.
For example, a user can define a config that is valid only when a specific device is connected.
Top comments (0)