giflet

Screen Gif Recorder

🎥 Giflet

A high-precision, "over-engineered" GIF recorder for Linux.

Giflet allows you to select a region of your screen, record it to an optimized GIF, automatically copy the file to your clipboard, and get a desktop notification when it's done.

It is designed to be the fastest way to get a screen recording into Slack, Discord, or GitHub issues.

🚜 The "Riding Lawn Mower" Philosophy

"Why did you write this in Rust? Wouldn't a Bash script or Go program have been easier?"

Yes. Usually, for a task this size, I would reach for Go (the reliable weed whacker). It's fast, simple, and perfect for orchestrating subprocesses.

But Giflet has one specific requirement: Global Input Monitoring. I wanted to stop recording by hitting Esc without having to click back into the terminal window first.

Implementing global key hooks in high-level languages often involves messy C-bindings (CGO) or fragile dependencies that break cross-compilation. Doing it in Rust is like bringing a riding lawn mower to trim a 10x10 patch of grass. It might look excessive, but when that grass turns out to be made of steel wire (low-level Linux X11/Wayland input APIs), you'll be glad you brought the heavy machinery.

✨ Features

  • Precision Selection: Uses slop for pixel-perfect screen selection.
  • Global Hotkey: Stop recording instantly by pressing Esc anywhere (no focus needed).
  • Clipboard Integration: Automatically copies the file URI to the clipboard, allowing you to paste directly into Discord/Slack upload dialogs.
  • Desktop Notifications: Native Linux notification when the clip is ready (with file size).
  • Clean Shutdown: Handles FFmpeg termination gracefully to prevent corrupt GIF headers.

🛠️ Prerequisites

Giflet relies on a few standard Linux tools to do the heavy lifting.

# Ubuntu / Debian
sudo apt install ffmpeg slop xclip libx11-dev libxtst-dev

# Arch Linux
sudo pacman -S ffmpeg slop xclip

Note: If you are on Wayland, you may need wl-clipboard instead of xclip.

🚀 Installation

  1. Clone the repository:

    git clone https://github.com/SarahRoseLives/giflet.git
    cd giflet
  2. Build and Run:

    cargo run --release
  3. (Optional) Install globally:

    cargo install --path .

🎮 Usage

  1. Run giflet in your terminal.
  2. Your cursor will turn into a crosshair. Click and drag to select the area you want to record.
  3. Perform your action within the selected box.
  4. Press Esc on your keyboard (you don't need to focus the terminal).
  5. Wait for the notification: "Copied to clipboard!"
  6. Ctrl + V into Discord, Slack, or GitHub.

🔧 Troubleshooting

"The Esc key isn't working!" If you are on Wayland, global key logging is restricted for security. You may need to add your user to the input group:

sudo usermod -aG input $USER
# Log out and log back in for this to take effect.

"Nothing pastes into Discord." Ensure you have xclip installed. Giflet copies the file as a text/uri-list, which most Electron apps (Discord/Slack) interpret as a file upload. If you are using a strictly Wayland environment, you might need to swap the xclip command for wl-copy in the source code.