The installer asks for the language before the keyboard, and Setup > Language (omarchy language en|zh) switches it later. Under zh_CN the menu reads its labels from omarchy-menu.zh-cn.jsonc, the shell from I18nZh.js through I18n.tr, and notifications are worded by their sender through omarchy-text, which reads the same table. User text is never translated.
27 lines
807 B
Bash
Executable File
27 lines
807 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Extract text from a screenshot region with OCR
|
|
# omarchy:group=capture
|
|
# omarchy:examples=omarchy capture text
|
|
|
|
# Keep hyprpicker alive until after grim captures so the screenshot sees the
|
|
# frozen overlay rather than live content shifting during teardown.
|
|
cleanup_freeze() {
|
|
[[ -n $PID ]] && kill $PID 2>/dev/null
|
|
}
|
|
trap cleanup_freeze EXIT
|
|
|
|
hyprpicker -r -z >/dev/null 2>&1 &
|
|
PID=$!
|
|
sleep .1
|
|
SELECTION=$(slurp 2>/dev/null)
|
|
|
|
[[ -z $SELECTION ]] && exit 0
|
|
|
|
TEXT=$(grim -g "$SELECTION" - | tesseract stdin stdout --oem 1 --psm 6 -l "${OMARCHY_OCR_LANGS:-eng}" --dpi 300 -c preserve_interword_spaces=1 2>/dev/null) || exit 1
|
|
|
|
[[ -z $TEXT ]] && exit 1
|
|
|
|
printf "%s" "$TEXT" | wl-copy
|
|
omarchy-notification-send -g "$(omarchy-text "Copied text from selection to clipboard")"
|