diff --git a/.SRCINFO b/.SRCINFO index c6573ae..f6ab7dc 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = ocr4linux-git pkgdesc = OCR CLI Tool for Extracting Text from Screenshots using bash and python for both x11 and wayland. - pkgver = 1.4.2.r56.4b6a174 + pkgver = 1.4.2.r57.e7e63f9 pkgrel = 1 url = https://github.com/moheladwy/OCR4Linux arch = any @@ -23,7 +23,7 @@ pkgbase = ocr4linux-git depends = scrot depends = rofi provides = OCR4Linux - source = ocr4linux-git-1.4.2.r56.4b6a174::git+https://github.com/moheladwy/OCR4Linux + source = ocr4linux-git-1.4.2.r57.e7e63f9::git+https://github.com/moheladwy/OCR4Linux sha256sums = SKIP pkgname = ocr4linux-git diff --git a/OCR4Linux.sh b/OCR4Linux.sh index 0399f88..aa766f3 100755 --- a/OCR4Linux.sh +++ b/OCR4Linux.sh @@ -33,7 +33,10 @@ SCREENSHOT_NAME="screenshot_$(date +%d%m%Y_%H%M%S).jpg" SCREENSHOT_DIRECTORY="$HOME/Pictures/screenshots" -OCR4Linux_HOME="$(pwd)" +# Get the absolute path of the script itself, handling symlinks +SCRIPT_PATH=$(realpath "$0") +# Extract the directory part +OCR4Linux_HOME="$(dirname "$SCRIPT_PATH")" OCR4Linux_PYTHON_NAME="OCR4Linux.py" OCR4Linux_CONFIG="$HOME/.config/OCR4Linux" TEXT_OUTPUT_FILE_NAME="$OCR4Linux_CONFIG/output_text.txt" @@ -43,6 +46,7 @@ REMOVE_SCREENSHOT=false KEEP_LOGS=false LANG_SPECIFIED=false SPECIFIED_LANGS="" +VERSION="v1.4.2" langs=() @@ -66,12 +70,14 @@ show_help() { echo " -d DIRECTORY Set screenshot directory (default: $SCREENSHOT_DIRECTORY)" echo " -l Keep logs" echo " --lang LANGUAGES Specify OCR languages (e.g., 'all', 'eng', 'eng+ara')" - echo " -h Show this help message, then exit" + echo " -v | --version Print the package version, then exist" + echo " -h | --help Show this help message, then exit" echo "Example:" echo " OCR4Linux.sh -d $HOME/screenshots -l" echo " OCR4Linux.sh --lang eng+ara" echo " OCR4Linux.sh --lang all -l" echo " OCR4Linux.sh -h" + echo " OCR4Linux.sh -v" echo "Note:" echo " - If --lang is not specified, an interactive language selection menu will appear" echo " - Use 'all' to select all available languages" @@ -99,10 +105,14 @@ while [[ $# -gt 0 ]]; do LANG_SPECIFIED=true shift 2 ;; - -h) + -h|--help) show_help exit 0 ;; + -v|--version) + echo "${VERSION}" + exit 0 + ;; *) echo "Unknown option: $1" show_help diff --git a/PKGBUILD b/PKGBUILD index 9acdbbd..8427f22 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: moheladwy pkgname=ocr4linux-git -pkgver=1.4.2.r56.4b6a174 +pkgver=1.4.2.r57.e7e63f9 pkgrel=1 pkgdesc="OCR CLI Tool for Extracting Text from Screenshots using bash and python for both x11 and wayland." arch=('any') diff --git a/README.md b/README.md index 29a6050..4c984f2 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a - `tesseract` OCR engine - `tesseract-data-eng` English language pack - `tesseract-data-ara` Arabic language pack +- `rofi` for the interactive language selection feature. - If you need any other language other than the above two, search for it using the command: ```sh @@ -64,16 +65,24 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a - `grimblast-git` - `wl-clipboard` - `cliphist` - - `rofi-wayland` - X11: - `scrot` - `xclip` - - `rofi` - -**Note:** `rofi` is required for the interactive language selection feature. ## Installation +### Option 1: Install from AUR (Recommended) + +The easiest way to install OCR4Linux on Arch Linux or any Arch-based distribution is directly from the AUR: + +```sh +yay -S ocr4linux-git +``` + +This will automatically install OCR4Linux and all its required dependencies. + +### Option 2: Manual Installation + 1. Clone the repository: ```sh @@ -90,6 +99,7 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a **Note:** The setup script will: + - Prompt you to confirm before proceeding with the manual installation - Install all required dependencies (tesseract, rofi, screenshot tools, etc.) - Copy all OCR4Linux files to `~/.config/OCR4Linux/` - Set up the necessary directory structure @@ -116,7 +126,9 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a - Allow you to select one or multiple languages for OCR processing - Take a screenshot of the selected area after language selection - Extract text from the image using the selected languages - - Copy the extracted text to the clipboard### Language Selection + - Copy the extracted text to the clipboard + +### Language Selection You have two options for language selection: @@ -162,9 +174,9 @@ The complete OCR4Linux workflow: | `-r` | Remove screenshot after processing | `false` | | `-d DIR` | Set screenshot directory | `$HOME/Pictures/screenshots` | | `-l` | Keep logs | `false` | -| `-u, --update` | Show update instructions | - | | `--lang LANGUAGES` | Specify OCR languages (bypasses rofi) | Interactive selection | -| `-h` | Show help message | - | +| `-v, --version` | Print the package version, then exit | - | +| `-h, --help` | Show help message, then exit | - | **Language Format for `--lang`**: @@ -209,6 +221,9 @@ The complete OCR4Linux workflow: ./OCR4Linux.sh --lang eng -l -r ./OCR4Linux.sh --lang all -d ~/screenshots -l +# Print version +./OCR4Linux.sh -v + # Show help ./OCR4Linux.sh -h ``` @@ -289,7 +304,7 @@ python OCR4Linux.py --help - [OCR4Linux.py](https://github.com/moheladwy/OCR4Linux/blob/main/OCR4Linux.py): Python script to preprocess the image and extract text using `tesseract` with support for custom language selection. - [OCR4Linux.sh](https://github.com/moheladwy/OCR4Linux/blob/main/OCR4Linux.sh): Shell script that provides both interactive language selection via rofi and direct command-line language specification, takes a screenshot, passes it to the python script with selected languages, gets the extracted text, and copies it to the clipboard. -- [setup.sh](https://github.com/moheladwy/OCR4Linux/blob/main/setup.sh): Shell script to install the required packages and copy the necessary files to the configuration directory (run this script the first time you clone the repository only). +- [setup.sh](https://github.com/moheladwy/OCR4Linux/blob/main/setup.sh): Shell script to install the required packages and copy the necessary files to the configuration directory. Intended for manual installation only — Arch-based users are encouraged to use the AUR package instead. ## Contributing