Configuring touchegg

Hi all, super newb here so apologies for the possibly dumb question. I’m just getting started with NixOS, and I’m trying to set up gesture recognition with Cinnamon de. On other distros, touchegg has been super helpful for that. On NixOS, you can install it with

services.touchegg.enable = true;

but there don’t appear to be any options for configuring it, that is specifying the commands that should be associated with each gesture. This information is stored in a config file in ${pkgs.touchegg}/share/touchegg/touchegg.conf. I can’t edit it directly since it’s read-only, and the Touché flatpak app which is used to edit it in other distros also doesn’t work (no surprise there).

So I’m wondering–is there something I can put into my configuration.nix file to overwrite touchegg’s default config with my own desired config?

Thanks for the help.

(Read the If you use nixos-unstable... part first if you use nixos-unstable)


Touchegg is something I am also interested but I haven’t got time to actually investigate :dizzy_face:

It looks like both touchegg and touche does not load system config if a user config exists, so to get things configured, I imagine you just need to edit ~/.config/touchegg/touchegg.conf.

Unfortunately sounds like touche checks if you have touchegg installed by checking system config existence, and in detail, it first checks XDG_CONFIG_DIRS, then a fallback path that can be configured by a meson option.

Looking at flatpak touche’s manifest, the fallback path is set to /var/run/host/usr/share/touchegg/touchegg.conf so we can only do something with XDG_CONFIG_DIRS instead. I am quite lazy here and just did something dirty, I added this to my NixOS config:

{
  # This file is useless since touchegg will use the user config instead.
  environment.etc."xdg/touchegg/touchegg.conf".text = "<touchégg></touchégg>";
}

So we can find this file in /etc/xdg/touchegg/touchegg.conf, now we tell flatpak touche this file (the /var/run/host prefix is needed here):

$ flatpak override --user --env=XDG_CONFIG_DIRS=/var/run/host/etc/xdg com.github.joseexposito.touche

Flatpak touche now opens for me and can edit my ~/.config/touchegg/touchegg.conf:

Though I am asking myself why am I so lazy to properly package this in Nix, so we can just pass a good meson flag to fix the touchegg detection :upside_down_face:

If you use nixos-unstable…

It is probably worth to mention that starting from Cinnamon 5.8, cinnamon itself can act as a touchegg client, and it doesn’t sound like this client will respect any of the touchegg.conf files, instead you need to play with gsettings (you can also just use cinnamon-settings gestures to do the settings in GUI):

$ gsettings get org.cinnamon.gestures swipe-up-3 
'TOGGLE_OVERVIEW'

The original touchegg client however, is now blocked by cinnamon-session. Well I imagine it is not good to have multiple clients and I do recommend the cinnamon one if it already works fine. If you do need the upstream client, I can imagine (did not test) that you can unblock that by:

$ gsettings set org.cinnamon.SessionManager autostart-blacklist "['gnome-settings-daemon', 'org.gnome.SettingsDaemon', 'gnome-fallback-mount-helper', 'gnome-screensaver', 'mate-screensaver', 'mate-keyring-daemon', 'indicator-session', 'gnome-initial-setup-copy-worker', 'gnome-initial-setup-first-login', 'gnome-welcome-tour', 'xscreensaver-autostart', 'nautilus-autostart', 'caja', 'xfce4-power-manager']"

And disable the cinnamon one:

$ gsettings set org.cinnamon.gestures enabled false
1 Like

Awesome, thank you for looking into this. And sorry, I should have provided more information about my setup.

  1. I’m aiming to avoid nixos unstable because I want to set up a machine for work. That said, I’ve been following Cinnamon 5.8 with interest. It’s unclear to me whether 23.05 is likely get that Cinnamon update, or whether it will be in the next stable nixos release.

  2. That’s a nice solution for Touché. For my own purposes, I want to handle all my configuration in configuration.nix, so it looks like my solution is even simpler. I just need to add a couple home manager options.

{
  home.file."touchegg".target = "/config/touchegg/touchegg.conf"
  home.file."touchegg".source = ...  # or .text if I just want to include everything in a nix config file and import it
}

Very simple. Thanks again for the help, and good luck with your own efforts.