Skip to content

Commit 9951aa7

Browse files
authored
Merge pull request #33 from moheladwy/fix/path-error
fixed the path error along side the docs
2 parents e7e63f9 + 1835683 commit 9951aa7

4 files changed

Lines changed: 39 additions & 14 deletions

File tree

.SRCINFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = ocr4linux-git
22
pkgdesc = OCR CLI Tool for Extracting Text from Screenshots using bash and python for both x11 and wayland.
3-
pkgver = 1.4.2.r56.4b6a174
3+
pkgver = 1.4.2.r57.e7e63f9
44
pkgrel = 1
55
url = https://github.com/moheladwy/OCR4Linux
66
arch = any
@@ -23,7 +23,7 @@ pkgbase = ocr4linux-git
2323
depends = scrot
2424
depends = rofi
2525
provides = OCR4Linux
26-
source = ocr4linux-git-1.4.2.r56.4b6a174::git+https://github.com/moheladwy/OCR4Linux
26+
source = ocr4linux-git-1.4.2.r57.e7e63f9::git+https://github.com/moheladwy/OCR4Linux
2727
sha256sums = SKIP
2828

2929
pkgname = ocr4linux-git

OCR4Linux.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
SCREENSHOT_NAME="screenshot_$(date +%d%m%Y_%H%M%S).jpg"
3535
SCREENSHOT_DIRECTORY="$HOME/Pictures/screenshots"
36-
OCR4Linux_HOME="$(pwd)"
36+
# Get the absolute path of the script itself, handling symlinks
37+
SCRIPT_PATH=$(realpath "$0")
38+
# Extract the directory part
39+
OCR4Linux_HOME="$(dirname "$SCRIPT_PATH")"
3740
OCR4Linux_PYTHON_NAME="OCR4Linux.py"
3841
OCR4Linux_CONFIG="$HOME/.config/OCR4Linux"
3942
TEXT_OUTPUT_FILE_NAME="$OCR4Linux_CONFIG/output_text.txt"
@@ -43,6 +46,7 @@ REMOVE_SCREENSHOT=false
4346
KEEP_LOGS=false
4447
LANG_SPECIFIED=false
4548
SPECIFIED_LANGS=""
49+
VERSION="v1.4.2"
4650

4751
langs=()
4852

@@ -66,12 +70,14 @@ show_help() {
6670
echo " -d DIRECTORY Set screenshot directory (default: $SCREENSHOT_DIRECTORY)"
6771
echo " -l Keep logs"
6872
echo " --lang LANGUAGES Specify OCR languages (e.g., 'all', 'eng', 'eng+ara')"
69-
echo " -h Show this help message, then exit"
73+
echo " -v | --version Print the package version, then exist"
74+
echo " -h | --help Show this help message, then exit"
7075
echo "Example:"
7176
echo " OCR4Linux.sh -d $HOME/screenshots -l"
7277
echo " OCR4Linux.sh --lang eng+ara"
7378
echo " OCR4Linux.sh --lang all -l"
7479
echo " OCR4Linux.sh -h"
80+
echo " OCR4Linux.sh -v"
7581
echo "Note:"
7682
echo " - If --lang is not specified, an interactive language selection menu will appear"
7783
echo " - Use 'all' to select all available languages"
@@ -99,10 +105,14 @@ while [[ $# -gt 0 ]]; do
99105
LANG_SPECIFIED=true
100106
shift 2
101107
;;
102-
-h)
108+
-h|--help)
103109
show_help
104110
exit 0
105111
;;
112+
-v|--version)
113+
echo "${VERSION}"
114+
exit 0
115+
;;
106116
*)
107117
echo "Unknown option: $1"
108118
show_help

PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Maintainer: moheladwy <mohamed.h.eladwy@gmail.com>
22
pkgname=ocr4linux-git
3-
pkgver=1.4.2.r56.4b6a174
3+
pkgver=1.4.2.r57.e7e63f9
44
pkgrel=1
55
pkgdesc="OCR CLI Tool for Extracting Text from Screenshots using bash and python for both x11 and wayland."
66
arch=('any')

README.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a
4747
- `tesseract` OCR engine
4848
- `tesseract-data-eng` English language pack
4949
- `tesseract-data-ara` Arabic language pack
50+
- `rofi` for the interactive language selection feature.
5051
- If you need any other language other than the above two, search for it using the command:
5152

5253
```sh
@@ -64,16 +65,24 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a
6465
- `grimblast-git`
6566
- `wl-clipboard`
6667
- `cliphist`
67-
- `rofi-wayland`
6868
- X11:
6969
- `scrot`
7070
- `xclip`
71-
- `rofi`
72-
73-
**Note:** `rofi` is required for the interactive language selection feature.
7471

7572
## Installation
7673

74+
### Option 1: Install from AUR (Recommended)
75+
76+
The easiest way to install OCR4Linux on Arch Linux or any Arch-based distribution is directly from the AUR:
77+
78+
```sh
79+
yay -S ocr4linux-git
80+
```
81+
82+
This will automatically install OCR4Linux and all its required dependencies.
83+
84+
### Option 2: Manual Installation
85+
7786
1. Clone the repository:
7887

7988
```sh
@@ -90,6 +99,7 @@ I didn't find any easy tool in Linux that does the same thing as the PowerTool a
9099

91100
**Note:** The setup script will:
92101

102+
- Prompt you to confirm before proceeding with the manual installation
93103
- Install all required dependencies (tesseract, rofi, screenshot tools, etc.)
94104
- Copy all OCR4Linux files to `~/.config/OCR4Linux/`
95105
- 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
116126
- Allow you to select one or multiple languages for OCR processing
117127
- Take a screenshot of the selected area after language selection
118128
- Extract text from the image using the selected languages
119-
- Copy the extracted text to the clipboard### Language Selection
129+
- Copy the extracted text to the clipboard
130+
131+
### Language Selection
120132
121133
You have two options for language selection:
122134
@@ -162,9 +174,9 @@ The complete OCR4Linux workflow:
162174
| `-r` | Remove screenshot after processing | `false` |
163175
| `-d DIR` | Set screenshot directory | `$HOME/Pictures/screenshots` |
164176
| `-l` | Keep logs | `false` |
165-
| `-u, --update` | Show update instructions | - |
166177
| `--lang LANGUAGES` | Specify OCR languages (bypasses rofi) | Interactive selection |
167-
| `-h` | Show help message | - |
178+
| `-v, --version` | Print the package version, then exit | - |
179+
| `-h, --help` | Show help message, then exit | - |
168180
169181
**Language Format for `--lang`**:
170182
@@ -209,6 +221,9 @@ The complete OCR4Linux workflow:
209221
./OCR4Linux.sh --lang eng -l -r
210222
./OCR4Linux.sh --lang all -d ~/screenshots -l
211223
224+
# Print version
225+
./OCR4Linux.sh -v
226+
212227
# Show help
213228
./OCR4Linux.sh -h
214229
```
@@ -289,7 +304,7 @@ python OCR4Linux.py --help
289304
290305
- [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.
291306
- [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.
292-
- [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).
307+
- [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.
293308
294309
## Contributing
295310

0 commit comments

Comments
 (0)