Skip to content

Lightning-fast OCR tool optimized for Wayland/Hyprland on Arch Linux. Select screen area → Extract text → Copy to clipboard.

License

Notifications You must be signed in to change notification settings

amebalabs/trex-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TRex - Text Recognition for Arch Linux

PyPI version Python 3.8+ Arch Linux Wayland License: MIT

Lightning-fast OCR and QR code reader for Wayland/Hyprland on Arch Linux. Select screen area → Extract text or decode QR → Copy to clipboard.

Features

  • 🎯 Simple - One command to capture and extract text
  • Lightning Fast - Tesseract by default, results in under 0.5s
  • 🖥️ Wayland Native - Built for modern Linux desktops
  • 📋 Clipboard Integration - Automatically copies extracted text
  • 🎨 Flexible - Fast mode by default, --accurate flag for complex text
  • 🔗 URL Detection - Automatically detect and open URLs in extracted text
  • 📱 QR Code Detection - Decode QR codes automatically

Installation

PyPI - Downloads PyPI - Format

# Install system dependencies (Arch Linux)
sudo pacman -S grim slurp wl-clipboard tesseract tesseract-data-eng zbar

# Install TRex
pip install trex-ocr

TRex includes both text OCR (using Tesseract by default) and QR code reading out of the box.

Usage

# Default: Select area → OCR → Copy to clipboard
trex

# OCR image from clipboard
trex -c

# OCR image file
trex -f screenshot.png

# Output to stdout instead of clipboard
trex -o stdout

# Use different language (e.g., German)
trex -l deu

# Use accurate mode for complex/handwritten text
trex --accurate

# Automatically open detected URLs in browser
trex --open-urls

# QR code mode - decode QR codes, fallback to OCR if none found
trex --qr

# Decode QR code and open if it's a URL
trex --qr --open-urls

Performance

  • Default mode: ~0.3-0.5s (Tesseract)
  • Accurate mode: ~2-3s (EasyOCR, downloads AI models on first use)

Languages

Tesseract (default): Uses standard 3-letter codes

  • eng - English (default)
  • deu - German
  • fra - French
  • spa - Spanish
  • jpn - Japanese
  • Install more: sudo pacman -S tesseract-data-[lang]

EasyOCR (--accurate mode):

Configuration

Optional config file at ~/.config/trex/config.json:

{
  "language": "en",
  "gpu": false,
  "open_urls": false,
  "qr_mode": false
}
  • Set "gpu": true if you have NVIDIA GPU with CUDA support
  • Set "open_urls": true to automatically open detected URLs by default
  • Set "qr_mode": true to use QR code mode by default

Requirements

  • Arch Linux
  • Wayland compositor (tested on Hyprland)
  • Python 3.8+
  • CUDA (optional, for GPU acceleration)

Accurate Mode Setup

For complex images, handwriting, or multiple languages:

# Install accurate mode dependencies
pip install trex-ocr[accurate] --extra-index-url https://download.pytorch.org/whl/cpu

# Or with GPU support (NVIDIA CUDA)
pip install trex-ocr[accurate,gpu]

Then use trex --accurate for better accuracy at the cost of speed.

License

MIT

About

Lightning-fast OCR tool optimized for Wayland/Hyprland on Arch Linux. Select screen area → Extract text → Copy to clipboard.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •