DREI is a web-based text editor built with Tauri that implements Emacs-style keyboard shortcuts and text navigation. The editor loads web content from a URL, allows editing with Emacs key bindings, and can save changes back to the server.
I wrote a blog post explaining what DREI is, why I wrote it, and what its limitations are.
- Rust 1.82 or newer
- System dependencies for Tauri:
- Debian/Ubuntu:
libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev xdg-utils - Fedora:
webkit2gtk4.1-devel - Arch:
webkit2gtk-4.1
- Debian/Ubuntu:
- Podman (or Docker)
make buildsudo make installdrei --selector .contents --url https://speechcode.local/blog/cosmic-chordThe project includes a Dockerfile that builds the Linux application in a container, avoiding the need to install build dependencies on your host system.
Use the provided script to build in a container and extract the binary:
./extract-binary.sh --buildThis will:
- Build a container image with all necessary build dependencies
- Compile the DREI application inside the container
- Extract the compiled binary to
./build/drei - Check if webkit2gtk is installed on your system
The script automatically builds the image if it doesn’t exist.
./extract-binary.sh [OPTIONS]
Options:
--build Force rebuild of the container image
--image NAME Image name to extract from (default: drei:latest)
--output PATH Output path for extracted binary (default: ./build/drei)
-h, --help Show help messageIf you prefer to build manually:
# Build the image
podman build -t drei:latest .
# Create a temporary container and extract the binary
CONTAINER_ID=$(podman create drei:latest)
podman cp $CONTAINER_ID:/app/src-tauri/target/release/drei ./drei
podman rm $CONTAINER_ID
chmod +x ./dreiAfter extracting the binary, you need webkit2gtk installed on your system to run it:
sudo apt-get install libwebkit2gtk-4.1-0sudo dnf install webkit2gtk4.1sudo pacman -S webkit2gtk-4.1DREI requires the following command-line arguments:
--selector SELECTOR(required): CSS selector for the editable content element--url URL(optional): URL to load (HTTP GET) and edit (HTTP POST)--file PATH(optional): Local file path to load and edit
Note: At least one of --url or --file must be provided.
# Edit content from a URL
./src-tauri/target/release/drei --selector .contents --url https://example.com/page
# Edit a local HTML file
./src-tauri/target/release/drei --selector .contents --file /path/to/page.html
# Run the container-built binary with a URL
./build/drei --selector .contents --url https://example.com/page
# Run the container-built binary with a local file
./build/drei --selector .contents --file ./test.htmlFor development with auto-reload:
cargo tauri dev -- -- --selector .contents --url https://example.com/pageSee CLAUDE.md for complete documentation of Emacs key bindings and editor features.
C-f: Forward characterC-b: Backward character
M-f: Forward wordM-b: Backward word
C-a: Beginning of lineC-e: End of lineC-n: Forward line (next line)C-p: Backward line (previous line)
M-e: Forward sentenceM-a: Backward sentence
M-}: Forward paragraphM-{: Backward paragraph
M->: End of bufferM-<: Beginning of buffer
C-d: Kill forward characterM-d: Kill forward wordM-Backspace: Kill backward wordM-k: Kill forward sentenceC-x Backspace: Kill backward sentenceC-w: Kill region (cut selection)
M-w: Save region to kill ring (copy)C-y: Yank (paste)
M-c: Capitalize wordM-l: Downcase wordM-u: Upcase word
C-t: Transpose charactersM-t: Transpose words
C-SPCorC-Space: Set mark (activate region)C-g: Cancel/deactivate region
M-x: Execute command
C-x C-s: Save pageC-q: Quit application
If the application window appears blank, check the console output for errors. Common issues:
- Server not running: The URL must be accessible and return valid HTML.
- File not found: The file path must exist and be readable.
- Network error: Check firewall and DNS settings.
- Missing selector: The CSS selector must match an element in the loaded page.
If you see “Failed to load page” errors:
- Verify the server is running.
- Check that the URL is correct and accessible.
- Ensure the server is configured to respond to requests from the application.
- Verify the file exists at the specified path.
- Check that the file has read permissions.
- Ensure the file contains valid HTML.
If the binary fails to run with library errors, install webkit2gtk runtime dependencies (see “Installing Runtime Dependencies” above).
See the project repository for license information.