deans-dox
 / Linux / MBP-Linux-Gestures.md

Setup Gestures on MBP2015

  • installing tools for gestures
  • installing Fusuma
  • creating a default gesture config
  • putting your user in the input group
  • creating a user-level systemd unit file ready to enable

🧾 Script: setup-mbp-gestures.sh

Run this on your installed LMDE system (not the live session):

cat << 'EOF' > setup-mbp-gestures.sh
#!/usr/bin/env bash
set -euo pipefail

if [[ $EUID -ne 0 ]]; then
  echo "Please run this script as root, e.g.: sudo bash setup-mbp-gestures.sh"
  exit 1
fi

PRIMARY_USER="${SUDO_USER:-""}"

if [[ -z "$PRIMARY_USER" ]]; then
  echo "[!] Could not detect primary non-root user (SUDO_USER is empty)."
  echo "    Please run this script via: sudo bash setup-mbp-gestures.sh from your normal user."
  exit 1
fi

echo "[*] Detected primary user: $PRIMARY_USER"

echo "[*] Updating package lists..."
apt update

echo "[*] Installing required packages for gestures (libinput-tools, xdotool, wmctrl, Ruby)..."
apt install -y \
  libinput-tools \
  xdotool \
  wmctrl \
  ruby-full

echo "[*] Installing Fusuma (gesture daemon) via Ruby gems..."
gem install fusuma --no-document

USER_HOME=$(eval echo "~$PRIMARY_USER")

echo "[*] Creating Fusuma config directory for $PRIMARY_USER..."
mkdir -p "$USER_HOME/.config/fusuma"

cat << 'EOC' > "$USER_HOME/.config/fusuma/config.yml"
swipe:
  3:
    left:
      command: "xdotool key alt+Right"
    right:
      command: "xdotool key alt+Left"
    up:
      command: "xdotool key ctrl+alt+Up"
    down:
      command: "xdotool key ctrl+alt+Down"
  4:
    up:
      command: "xdotool key super"
    down:
      command: "xdotool key ctrl+alt+Down"

pinch:
  in:
    command: "xdotool key ctrl+minus"
  out:
    command: "xdotool key ctrl+plus"

interval:
  swipe: 0.7
  pinch: 0.5
threshold:
  swipe: 0.5
  pinch: 0.1
EOC

chown -R "$PRIMARY_USER":"$PRIMARY_USER" "$USER_HOME/.config/fusuma"

echo "[*] Adding $PRIMARY_USER to 'input' group (required for reading touchpad events)..."
gpasswd -a "$PRIMARY_USER" input || true

echo "[*] Creating user-level systemd service file for Fusuma..."
mkdir -p "$USER_HOME/.config/systemd/user"

cat << 'EOC' > "$USER_HOME/.config/systemd/user/fusuma.service"
[Unit]
Description=Fusuma multitouch gesture recognizer
After=graphical.target

[Service]
ExecStart=/usr/local/bin/fusuma
Restart=on-failure

[Install]
WantedBy=default.target
EOC

chown -R "$PRIMARY_USER":"$PRIMARY_USER" "$USER_HOME/.config/systemd"

echo
echo "======================================================="
echo "Fusuma gesture setup completed for user: $PRIMARY_USER"
echo
echo "Next steps (run these as $PRIMARY_USER, NOT root):"
echo
echo "  systemctl --user daemon-reload"
echo "  systemctl --user enable --now fusuma.service"
echo
echo "You may need to log out and log back in once after being added"
echo "to the 'input' group for Fusuma to see touchpad events properly."
echo
echo "To tweak gestures, edit:"
echo "  $HOME/.config/fusuma/config.yml"
echo "======================================================="
EOF

Then make it executable and run it:

chmod +x setup-mbp-gestures.sh
sudo ./setup-mbp-gestures.sh

▶️ After running the script

  1. As your normal user (not root), run:
systemctl --user daemon-reload
systemctl --user enable --now fusuma.service
  1. If gestures don’t work right away, log out and back in once (because of the new input group membership).

  2. Then test:

    • three-finger swipes (back/forward, workspace up/down)
    • four-finger up (Super key / overview)
    • pinch in/out (zoom)

You can always adjust bindings in:

~/.config/fusuma/config.yml

If you want to get fancy later (different gestures for specific apps, etc.), we can evolve that config once you’ve confirmed Fusuma is actually picking up the gestures.