Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swiped

A macOS daemon that executes commands in response to trackpad and Magic Mouse swipe gestures.

Requirements

  • macOS 13+
  • Swift 6.0+

Installation

git clone https://github.com/yourusername/swiped.git
cd swiped
./install.sh

This builds swiped, installs the binary, and sets up a launch agent to run it automatically.

Manual Installation

If you prefer to install manually:

swift build -c release
sudo cp .build/release/swiped /usr/local/bin/

Disable Default 3-Finger Gestures

To avoid conflicts with swiped, disable or change macOS built-in 3-finger gestures:

  1. Open System Settings → Trackpad → More Gestures
  2. Set "Swipe between full-screen applications" to Four Fingers (or off)
  3. Set "Mission Control" to Four Fingers (or off)

Alternatively, use 4-finger gestures in your swiped config instead.

For Magic Mouse 2-finger swipes, open System Settings → Mouse → More Gestures and turn off "Swipe between full-screen applications".

Usage

swiped                              # Uses ~/.config/swiped/config.toml
swiped --config /path/to/config.toml  # Custom config path

On first run, a default config file is generated if none exists.

Configuration

Config file location: ~/.config/swiped/config.toml

[settings]
velocity_threshold = 0.3  # Minimum swipe velocity to trigger
cooldown_ms = 250         # Cooldown between gestures

[[gestures]]
direction = "left"
fingers = 3
command = ["/opt/homebrew/bin/aerospace", "--no-stdin", "workspace", "next"]

[[gestures]]
direction = "right"
fingers = 3
command = ["/opt/homebrew/bin/aerospace", "--no-stdin", "workspace", "prev"]

[[gestures]]
device = "mouse"
direction = "left"
fingers = 2
command = ["/opt/homebrew/bin/aerospace", "--no-stdin", "workspace", "next"]

Note: AeroSpace requires --no-stdin when running from a launch agent (non-TTY context). See AeroSpace#1683.

Options

Field Description
direction left, right, up, or down
fingers Number of fingers (e.g., 3, 4)
command Array of strings: [executable, arg1, arg2, ...]
device trackpad (default) or mouse (Magic Mouse)

Trackpad gestures need at least 3 fingers (2 is scrolling); Magic Mouse gestures need at least 2, and every finger must move in the swipe direction.

Commands are executed directly without a shell wrapper.

Running as a Launch Agent

The install.sh script automatically sets up a launch agent. To manage it manually:

# Reload after changes
launchctl kickstart -k gui/$(id -u)/com.swiped

# Stop
launchctl bootout gui/$(id -u)/com.swiped

# Start
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.swiped.plist

Logs are written to /tmp/swiped.log.

How It Works

swiped links Apple's private MultitouchSupport framework directly and listens to every multitouch device (built-in trackpad, Magic Trackpad, Magic Mouse). Devices are rescanned every 2 seconds, so a Bluetooth mouse that connects later or reconnects after sleep is picked up. Touch frames arrive at ~90Hz, and a per-device gesture recognizer detects directional swipes based on average finger velocity.

License

MIT

About

A macOS daemon that executes commands in response to trackpad swipe gestures.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages