Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/getting-started/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gum
rsync
git
figlet
xdg-user-dirs
xdg-user-dirs
hyprland
hyprpaper
hyprlock
Expand Down Expand Up @@ -42,6 +42,9 @@ htop
blueman
grim
slurp
tesseract
tesseract-data-eng (or tesseract-langpack-eng on Fedora, tesseract-ocr-traineddata-eng on openSUSE)
wl-clipboard
cliphist
nwg-look
qt6ct
Expand Down
1 change: 1 addition & 0 deletions dotfiles/.config/hypr/conf/keybindings/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ bind = $mainMod SHIFT, A, exec, $HYPRSCRIPTS/toggle-animations.sh
bind = $mainMod, PRINT, exec, $HYPRSCRIPTS/screenshot.sh # Take a screenshot
bind = $mainMod ALT, F, exec, $HYPRSCRIPTS/screenshot.sh --instant # Take an instant full-screen screenshot
bind = $mainMod ALT, S, exec, $HYPRSCRIPTS/screenshot.sh --instant-area # Take an instant area screenshot
bind = $mainMod ALT, A, exec, $HYPRSCRIPTS/text-extractor.sh # Extract text from an area
bind = $mainMod CTRL, Q, exec, ~/.config/ml4w/scripts/wlogout.sh # Start wlogout
bind = $mainMod SHIFT, W, exec, ~/.config/hypr/scripts/waypaper.sh --random # Change the wallpaper
bind = $mainMod CTRL, W, exec, ~/.config/hypr/scripts/waypaper.sh # Open wallpaper selector
Expand Down
36 changes: 36 additions & 0 deletions dotfiles/.config/hypr/scripts/text-extractor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -Eeuo pipefail

PICKER_PID=""
SLURP_TIMEOUT=10
DEPS=(grim slurp magick tesseract wl-copy timeout)

die() { echo "Error: $*" >&2; exit 1; }
safe_kill() { [[ -n "${1:-}" ]] && kill "$1" 2>/dev/null || true; }
cleanup() { safe_kill "$PICKER_PID"; }
trap cleanup EXIT INT TERM

check_deps() {
local missing_dependencies=()
for dep in "${DEPS[@]}"; do command -v "$dep" >/dev/null 2>&1 || missing_dependencies+=("$dep"); done
if (( ${#missing_dependencies[@]} > 0 )); then
die "Missing dependencies: ${missing_dependencies[*]}"
fi
}

check_deps

hyprpicker -r -z &
PICKER_PID=$!
sleep 0.1 || true

REGION=$(timeout "$SLURP_TIMEOUT" slurp -b "#00000080" -c "#888888ff" -w 1) || die "No region selected (timeout or cancelled)"
[[ -z "$REGION" ]] && die "No region selected"
cleanup

grim -g "$REGION" - \
| magick - -colorspace Gray -normalize -contrast-stretch 2% -sharpen 0x1.0 -resize 200% png:- \
| tesseract - stdout -l eng --psm 6 \
| wl-copy \
|| die "Failed to capture or process text"
6 changes: 4 additions & 2 deletions setup/pkgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ apps=(
)

tools=(
"xdg-user-dirs"
"xdg-desktop-portal-gtk"
"xdg-user-dirs"
"xdg-desktop-portal-gtk"
"figlet"
"fastfetch"
"htop"
Expand All @@ -52,5 +52,7 @@ tools=(
"gvfs"
"grim"
"breeze"
"tesseract"
"wl-clipboard"
"btop"
)
1 change: 1 addition & 0 deletions setup/setup-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ packages=(
# Tools
"eza"
"python-pywalfox"
"tesseract-data-eng"
# Fonts
"otf-font-awesome"
"ttf-firacode-nerd"
Expand Down
1 change: 1 addition & 0 deletions setup/setup-fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ packages=(
"fuse"
"ImageMagick"
"NetworkManager-tui"
"tesseract-langpack-eng"
# Apps
"waypaper"
"swww"
Expand Down
1 change: 1 addition & 0 deletions setup/setup-opensuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ packages=(
"ImageMagick"
"NetworkManager-connection-editor"
"NetworkManager-tui"
"tesseract-ocr-traineddata-eng"
# Apps
"SwayNotificationCenter"
# Fonts
Expand Down