11# OCR4Linux
22
3- ** Version:** 1.4.2
3+ ** Version:** 1.5.0
44
55OCR4Linux is a versatile text extraction tool that allows you to take a screenshot of a selected area, extract text using OCR, and copy it to the clipboard. It supports both Wayland and X11 sessions and offers multiple language support.
66
@@ -73,15 +73,34 @@ I didn't find any easy tool in Linux that does the same thing as the PowerToys a
7373
7474# ## Option 1: Install from AUR (Recommended)
7575
76- The easiest way to install OCR4Linux on Arch Linux or any Arch-based distribution is directly from the AUR:
76+ The easiest way to install OCR4Linux on Arch Linux or any Arch-based distribution is directly from the AUR using any AUR helper (e.g., ` yay ` , ` paru ` ) :
7777
7878` ` ` sh
7979yay -S ocr4linux-git
8080` ` `
8181
8282This will automatically install OCR4Linux and all its required dependencies.
8383
84- # ## Option 2: Manual Installation
84+ # ## Option 2: Build from Source (makepkg)
85+
86+ You can clone the repository and build the package manually using ` makepkg` :
87+
88+ 1. Clone the repository:
89+
90+ ` ` ` sh
91+ git clone https://github.com/moheladwy/OCR4Linux.git
92+ cd OCR4Linux
93+ ` ` `
94+
95+ 2. Build and install the package:
96+
97+ ` ` ` sh
98+ makepkg -si
99+ ` ` `
100+
101+ # ## Option 3: Manual Installation (setup.sh)
102+
103+ If you prefer a local installation in your home directory or want to use the automated setup script:
85104
861051. Clone the repository:
87106
@@ -90,7 +109,7 @@ This will automatically install OCR4Linux and all its required dependencies.
90109 cd OCR4Linux
91110 ` ` `
92111
93- 2. Run the setup script to install the required packages and copy the necessary files to the configuration directory :
112+ 2. Run the setup script:
94113
95114 ` ` ` sh
96115 chmod +x setup.sh
@@ -106,17 +125,20 @@ This will automatically install OCR4Linux and all its required dependencies.
106125
107126# # Usage
108127
109- 1. Run the main script to take a screenshot, extract text, and copy it to the clipboard:
128+ 1. Run the tool to take a screenshot, extract text, and copy it to the clipboard:
110129
130+ If installed via AUR or ` makepkg` :
111131 ` ` ` sh
112- chmod +x ~ /.config/OCR4Linux/OCR4Linux.sh
113- ~ /.config/OCR4Linux/OCR4Linux.sh
132+ OCR4Linux
114133 ` ` `
115134
116- Or if you' re in the OCR4Linux directory:
135+ If installed via ` setup.sh` :
136+ ` ` ` sh
137+ ~ /.config/OCR4Linux/OCR4Linux.sh
138+ ` ` `
117139
140+ Or if you' re in the source directory:
118141 ```sh
119- chmod +x OCR4Linux.sh
120142 ./OCR4Linux.sh
121143 ```
122144
@@ -174,6 +196,7 @@ The complete OCR4Linux workflow:
174196| `-r` | Remove screenshot after processing | `false` |
175197| `-d DIR` | Set screenshot directory | `$HOME/Pictures/screenshots` |
176198| `-l` | Keep logs | `false` |
199+ | `-n, --notify` | Show notification after screenshot | `false` |
177200| `--lang LANGUAGES` | Specify OCR languages (bypasses rofi) | Interactive selection |
178201| `-v, --version` | Print the package version, then exit | - |
179202| `-h, --help` | Show help message, then exit | - |
@@ -200,34 +223,36 @@ The complete OCR4Linux workflow:
200223
201224---
202225
203- #### Using OCR4Linux.sh
226+ #### Using OCR4Linux
204227
205228```sh
206229# Basic usage (shows interactive rofi menu)
207- ./ OCR4Linux.sh
230+ OCR4Linux
208231
209232# Direct language specification (bypasses rofi)
210- ./ OCR4Linux.sh --lang eng
211- ./ OCR4Linux.sh --lang all
212- ./ OCR4Linux.sh --lang eng+ara+fra
233+ OCR4Linux --lang eng
234+ OCR4Linux --lang all
235+ OCR4Linux --lang eng+ara+fra
213236
214237# Save logs and remove screenshot after processing
215- ./ OCR4Linux.sh -l -r
238+ OCR4Linux -l -r
216239
217- # Custom screenshot directory with logging
218- ./ OCR4Linux.sh -d ~/Documents/screenshots -l
240+ # Custom screenshot directory with logging and notification
241+ OCR4Linux -d ~/Documents/screenshots -l -n
219242
220243# Combine language specification with other options
221- ./ OCR4Linux.sh --lang eng -l -r
222- ./ OCR4Linux.sh --lang all -d ~/screenshots -l
244+ OCR4Linux --lang eng -l -r
245+ OCR4Linux --lang all -d ~/screenshots -l
223246
224247# Print version
225- ./ OCR4Linux.sh -v
248+ OCR4Linux -v
226249
227250# Show help
228- ./ OCR4Linux.sh -h
251+ OCR4Linux -h
229252```
230253
254+ **Note:** If you are running the script manually without installation, replace `OCR4Linux` with `./OCR4Linux.sh`.
255+
231256#### Using OCR4Linux.py
232257
233258```sh
@@ -269,32 +294,35 @@ python OCR4Linux.py --help
269294 - Use `--lang all` only when document language is unknown
270295 - Command-line specification is faster than interactive selection
271296
272- - **Keyboard Shortcuts**: You can create a keyboard shortcut to run the script for easy access.
297+ - **Keyboard Shortcuts**: You can create a keyboard shortcut to run the script for easy access.
273298
274299 ### Example for `Hyprland` users:
275300
276301 - put the following lines in your `hyprland.conf` file:
277302
278303 ```conf
279- $OCR4Linux = ~/.config/OCR4Linux/OCR4Linux.sh
280- $OCR4Linux_ENG = ~/.config/OCR4Linux/OCR4Linux.sh --lang eng
304+ # If installed via AUR/makepkg
305+ bind = $mainMod SHIFT, E, exec, OCR4Linux # OCR4Linux with interactive selection
306+ bind = $mainMod SHIFT, T, exec, OCR4Linux --lang eng # OCR4Linux with English only
281307
282- bind = $mainMod SHIFT, E, exec, $OCR4Linux # OCR4Linux with interactive selection
283- bind = $mainMod SHIFT, T , exec, $OCR4Linux_ENG # OCR4Linux with English only
308+ # If installed via setup.sh
309+ # bind = $mainMod SHIFT, E , exec, ~/.config/ OCR4Linux/OCR4Linux.sh
284310 ```
285311
286312 ### Example for `dwm` users:
287313
288314 - put the following lines in your `config.h` file:
289315
290316 ```c
291- static const char *ocr4linux[] = { "sh", "-c", "~/.config/OCR4Linux/OCR4Linux.sh", NULL };
292- static const char *ocr4linux_eng[] = { "sh", "-c", "~/.config/OCR4Linux/OCR4Linux.sh --lang eng", NULL };
317+ /* If installed via AUR/makepkg */
318+ static const char *ocr4linux[] = { "OCR4Linux", NULL };
319+ static const char *ocr4linux_eng[] = { "OCR4Linux", "--lang", "eng", NULL };
293320
294321 { MODKEY | ShiftMask, XK_e, spawn, {.v = ocr4linux } }, // OCR4Linux interactive
295322 { MODKEY | ShiftMask, XK_t, spawn, {.v = ocr4linux_eng } }, // OCR4Linux English only
296323 ```
297324
325+
298326- **Language Optimization**: For best results:
299327 - Select only the languages present in your document
300328 - Use fewer languages for better performance
0 commit comments