No description
Find a file
The King Of Aussies 8a3436b2cd
Modify CLI commands for Shiftie usage
Updated CLI commands in README to use 'cargo run'.
2025-09-20 11:03:34 -04:00
src Add files via upload 2025-09-20 10:52:27 -04:00
Cargo.lock Add files via upload 2025-09-20 10:52:27 -04:00
Cargo.toml Add files via upload 2025-09-20 10:52:27 -04:00
README.md Modify CLI commands for Shiftie usage 2025-09-20 11:03:34 -04:00

⌨️ Shiftie

Shiftie is a tiny Rust daemon that watches your keyboard input and turns a dual-shift tap into a synthetic Escape key press. Perfect for people who like modal editors but only have so many fingers! 🧙‍♂️

Features

  • 🔁 Runs as a background daemon with PID and log files stored in your system temp directory (e.g., /tmp).
  • ⌨️ Auto-discovers evdev-compatible keyboards that report both left and right shift keys.
  • 🚨 Emits a virtual Escape key press the moment both shift keys are pressed together.
  • 🧹 Cleans up its PID file when the daemon exits.

🚀 Getting started

  1. 📦 Install Rust (https://rustup.rs/) if you don't have it already.
  2. 🛠️ Build the project:
    cargo build --release
    
  3. 🔐 Ensure you have permission to read from input devices (you may need to run as root or add your user to the appropriate input group).

🕹️ Usage

Shiftie ships with a small CLI built using clap:

cargo run start  # default; launches the daemon
cargo run stop   # sends SIGTERM to the running daemon
cargo run run    # runs in the foreground for debugging
  • When starting, Shiftie checks for an existing PID file at something like /tmp/shifty.pid and refuses to launch if another instance is alive.
  • The daemon writes logs to the temp directory as shifty.log.
  • run mode keeps everything in the foreground so you can watch log output in real time.

🧪 How it works

  • 🕵️‍♂️ Enumerates input devices with evdev and spawns a thread per device to listen for key events.
  • 🧮 Tracks the state of the left and right shift keys; once both are down simultaneously, an Escape key press/release sequence is emitted through a virtual keyboard created with evdev's uinput bindings.
  • 🧱 Uses a guard object to ensure PID files are cleaned up even on panic.

🛑 Stopping the daemon

Running shifty stop sends SIGTERM to the recorded PID and waits (up to 5 seconds) for the process to exit, tidying up the PID file when done.

🧰 Development

  • 📚 The code lives in src/main.rs.
  • 🧪 Run the daemon in the foreground while developing with:
    cargo run -- run
    
  • 🧹 Format/lint as you normally would; no extra tooling is required.

Enjoy the new Escape key superpower! 🚀