Added russian OCR screenshot

master
Mark 2022-08-02 16:43:28 -07:00
parent 40b43f940c
commit 5dca4a76b4
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
2 changed files with 25 additions and 4 deletions

View File

@ -20,17 +20,28 @@ return {
}
),
awful.key( {"Control"}, "Print",
awful.key( {"Control", "Shift"}, "Print",
function ()
screenshot_action("ocr")
screenshot_action("ocr-rus")
end,
{
description = "OCR Capture",
description = "OCR Capture (Russian)",
group = "Screenshot"
}
),
awful.key( {"Control"}, "Print",
function ()
screenshot_action("ocr-eng")
end,
{
description = "OCR Capture (English)",
group = "Screenshot"
}
),
awful.key( {"Shift"}, "Print",
function ()
screenshot_action("pin")

View File

@ -23,7 +23,7 @@ function capture
case pin
flameshot gui --accept-on-select --pin
case ocr
case ocr-eng
flameshot gui --accept-on-select --path $tmp_file
# Recognize text
@ -33,6 +33,16 @@ function capture
echo $ocr | sed -e "s/^[ \t]*//" | xclip -i -rmlastnl -selection clipboard
rm $tmp_file
case ocr-rus
flameshot gui --accept-on-select --path $tmp_file
# Recognize text
set ocr (tesseract --dpi 96 -l rus $tmp_file stdout)
# Trim whitespace and copy to clipboard
echo $ocr | sed -e "s/^[ \t]*//" | xclip -i -rmlastnl -selection clipboard
rm $tmp_file
case "*"
echo "Unknown action \"$argv[1]\""