Skip to content

d-matsui/rustile

Repository files navigation

Rustile

An X11 tiling window manager written in Rust, inspired by yabai and xpywm.

Rust X11 License

Rustile Window Manager

Key Features

  • Automatic Window Tiling - BSP (Binary Space Partitioning) layout with no manual arrangement needed
  • Keyboard-Driven Workflow - Full control without mouse dependency
  • Simple TOML Configuration - Intuitive, readable config files with live validation

Requirements

Runtime Requirements

  • X11 display server (Wayland/XWayland not supported)
  • Linux system (tested on Ubuntu 24.04)

Build Requirements (if building from source)

  • Rust toolchain (rustc, cargo)
  • X11 development libraries (libx11-dev, libxcb1-dev)

Installation

Option 1: Download Pre-built Binary

Download the latest release from GitHub Releases:

# Download and install (example for latest release)
wget https://github.com/d-matsui/rustile/releases/download/v1.0.0/rustile-v1.0.0-x86_64-linux.tar.gz
tar xzf rustile-v1.0.0-x86_64-linux.tar.gz
sudo cp rustile /usr/local/bin/
sudo chmod +x /usr/local/bin/rustile

Option 2: Build from Source

# Install build dependencies (Debian/Ubuntu)
sudo apt-get install build-essential libx11-dev libxcb1-dev

# Clone and build
git clone https://github.com/d-matsui/rustile.git
cd rustile
cargo build --release

# Install binary
sudo cp target/release/rustile /usr/local/bin/
sudo chmod +x /usr/local/bin/rustile

Quick Start - Try Rustile Safely

Option 1: Xephyr (Recommended - Keep your desktop running)

The safest way to try Rustile without affecting your current desktop:

# Install Xephyr if needed
sudo apt-get install xserver-xephyr

# Create a nested X server window
Xephyr :10 -screen 1280x720 -resizeable &

# Start Rustile in the nested display
DISPLAY=:10 rustile &

# Launch some test applications
DISPLAY=:10 xterm &
DISPLAY=:10 xcalc &

To stop: Simply close the Xephyr window.

Option 2: TTY Console (Advanced users)

Run Rustile on a different TTY while keeping your desktop session:

# Switch to TTY3 with Ctrl+Alt+F3 (TTY1/2 are often in use)
# Login with your username and password

# Using xinitrc
echo 'exec rustile > ~/.rustile.log 2>&1' > ~/.xinitrc
startx -- :10

# Switch between sessions:
# - Ctrl+Alt+F1 or F2: Back to your display manager/GNOME
# - Ctrl+Alt+F3: Back to Rustile session

To stop the session:

  1. Switch to another TTY (e.g., Ctrl+Alt+F4)
  2. Login and run: killall Xorg
  3. Return to your main session (Ctrl+Alt+F1 or F2)

Usage

Keyboard Shortcuts

Default shortcuts are configured in config.example.toml. Key bindings include:

  • Navigation: Alt+j/k (focus next/previous)
  • Window management: Shift+Alt+q (close), Alt+f (fullscreen), Alt+r (rotate)
  • Applications: Shift+Alt+1/2/3 (terminal/editor/browser)

See config.example.toml for the complete list.

Production Setup

Make Rustile Your Default Window Manager

Once you're comfortable with Rustile, choose one of these methods:

Option 1: Primary Window Manager (Minimal Environment)

Best for: Minimal systems or replacing other window managers

# Setup Rustile as default

# Create xinitrc
echo 'exec rustile > ~/.rustile.log 2>&1' > ~/.xinitrc

# Start X session
startx

Note: For input methods (IME), see ADR-013: IME Setup - configuration differs from running alongside desktop environments.

Option 2: Dedicated TTY (Alongside Desktop Environment)

Best for: Using Rustile alongside GNOME/KDE without conflicts

Step 1: Setup TTY3 auto-login

sudo systemctl edit getty@tty3.service

Add this configuration:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin USERNAME --noclear %I $TERM

Replace USERNAME with your actual username.

Step 2: Setup X auto-start on TTY3

# Add to ~/.bash_profile (create if it doesn't exist)
cat >> ~/.bash_profile << 'EOF'

# TTY3 Rustile auto-start
if [ "$(tty)" = "/dev/tty3" ]; then
    exec startx -- :10
fi
EOF

Step 3: Setup xinitrc for Rustile

echo 'exec rustile > ~/.rustile.log 2>&1' > ~/.xinitrc

Note: For Japanese input (or other input methods), you'll need additional configuration in .xinitrc. See ADR-013: IME Setup for fcitx5/DBus configuration.

Usage:

  • Ctrl+Alt+F3: Switch to Rustile environment
  • Ctrl+Alt+F1/F2: Return to your main desktop (GNOME/KDE)
  • Auto-login and X startup on TTY3

Optional Setup

Clipboard Manager

For proper copy-paste functionality in X11 applications (especially terminal emulators like Alacritty), you need a clipboard manager. Without it, clipboard content disappears when the source application closes.

Setup: Add the following to your ~/.xinitrc before the exec rustile line:

# Install xclip
sudo apt-get install xclip

# Add to ~/.xinitrc (before exec rustile)
# Clipboard manager for clipboard persistence (keeps clipboard after app closes)
xclip -selection clipboard -loops 0 &

# Your existing configuration
exec rustile > ~/.rustile.log 2>&1

What this enables:

  • Ctrl+Shift+C/V → Copy/paste via CLIPBOARD selection (in terminals like Alacritty)
  • Ctrl+C/V → Copy/paste in browsers and other GUI applications
  • Clipboard persistence → Content survives after closing the source application
  • Cross-application → Copy from Alacritty, paste to browser (and vice versa)

Note about -loops 0: This keeps xclip running permanently to handle unlimited clipboard requests. Do not use -loops 1 as it will exit after the first paste operation.

Disable Middle-Button Paste (Optional)

If you use a TrackPoint or other pointing device and accidentally trigger paste during scrolling, you can disable middle-button paste system-wide.

Setup: Add to your ~/.xinitrc (after the xclip line, before exec rustile):

# Find your device name first:
xinput list

# For ThinkPad TrackPoint (example):
xinput set-button-map "TPPS/2 Elan TrackPoint" 1 0 3 4 5 6 7

# The "0" in position 2 disables middle-button paste while keeping scrolling functional

To find your device name, run xinput list and look for your mouse/trackpoint device. Replace "TPPS/2 Elan TrackPoint" with your actual device name.

Verify Setup

After restarting Rustile, verify the configuration:

# Check if xclip is running:
ps aux | grep xclip

# Test clipboard persistence:
# 1. Open Alacritty, select text, press Ctrl+Shift+C
# 2. Close that Alacritty window
# 3. Open browser or another app, press Ctrl+V
# → Should paste the text (clipboard persisted after app closed)

# Test middle-button paste disabled:
# 1. Select some text with mouse
# 2. Middle-click or scroll with middle-button
# → Should NOT paste (scrolling still works)

Debugging & Troubleshooting

Enable Logging

# View debug output
# Log levels: error, warn, info, debug, trace
RUST_LOG=debug rustile 2>&1 | tee rustile.log

Documentation

License

MIT License - see LICENSE file for details.

About

An X11 tiling window manager written in Rust.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors