├── .editorconfig ├── .github ├── FUNDING.yml └── workflows │ ├── flatpak-build.yml │ └── vala-lint.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── com.github.rajsolai.textsnatcher.yml ├── data ├── com.github.rajsolai.textsnatcher.appdata.xml.in ├── com.github.rajsolai.textsnatcher.desktop.in ├── com.github.rajsolai.textsnatcher.gresource.xml ├── icons │ ├── 16 │ │ └── com.github.rajsolai.textsnatcher.svg │ ├── 24 │ │ └── com.github.rajsolai.textsnatcher.svg │ ├── 32 │ │ └── com.github.rajsolai.textsnatcher.svg │ ├── 48 │ │ └── com.github.rajsolai.textsnatcher.svg │ ├── 64 │ │ └── com.github.rajsolai.textsnatcher.svg │ ├── 128 │ │ └── com.github.rajsolai.textsnatcher.svg │ └── com.github.rajsolai.textsnatcher.svg ├── meson.build ├── screenshots │ ├── snap-dark.png │ └── snap-default.png ├── stylesheet.css └── textsnatcher-banner.svg ├── debian ├── changelog ├── control ├── copyright ├── rules └── source │ └── format ├── fbuild.sh ├── format.sh ├── gensha.py ├── gnomeapp.yml ├── manifests ├── leptonica.yml ├── libportal.yml └── tesseract.yml ├── meson.build ├── meson └── post_install.py ├── po ├── LINGUAS ├── POTFILES ├── extra │ ├── LINGUAS │ ├── POTFILES │ └── meson.build └── meson.build ├── run.sh ├── src ├── Application.vala ├── MainWindow.vala ├── components │ ├── AboutButton.vala │ ├── AboutDialog.vala │ ├── HeaderBar.vala │ ├── LanguageButton.vala │ ├── SelectPictureDialog.vala │ └── VerticalBox.vala ├── meson.build ├── screens │ ├── HomeScreen.vala │ ├── MainScreen.vala │ └── SelectPictureScreen.vala └── services │ ├── LanguageService.vala │ └── TesseractTrigger.vala └── vid.gif /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig 2 | root = true 3 | 4 | # elementary defaults 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = tab 9 | indent_style = space 10 | insert_final_newline = true 11 | max_line_length = 80 12 | tab_width = 4 13 | 14 | [{*.xml,*.xml.in,*.yml}] 15 | tab_width = 2 16 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: rajsolai 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/flatpak-build.yml: -------------------------------------------------------------------------------- 1 | name: flatpak-build 2 | 3 | # This workflow will run for any pull request or pushed commit 4 | on: [push, pull_request] 5 | 6 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 7 | jobs: 8 | # This workflow contains a single job called "flatpak" 9 | build: 10 | # The type of runner that the job will run on 11 | runs-on: ubuntu-latest 12 | 13 | # This job runs in a special container designed for building Flatpaks for AppCenter 14 | container: 15 | image: ghcr.io/elementary/flatpak-platform/runtime:6.1 16 | options: --privileged 17 | 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | steps: 20 | # Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it 21 | - uses: actions/checkout@v2 22 | 23 | # Builds your flatpak manifest using the Flatpak Builder action 24 | - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v3 25 | with: 26 | # This is the name of the Bundle file we're building and can be anything you like 27 | bundle: com.github.rajsolai.textsnatcher.flatpak 28 | # This uses your app's RDNN ID 29 | manifest-path: com.github.rajsolai.textsnatcher.yml 30 | 31 | # You can automatically run any of the tests you've created as part of this workflow 32 | run-tests: true 33 | 34 | # These lines specify the location of the elementary Runtime and Sdk 35 | # repository-name: appcenter 36 | # repository-url: https://flatpak.elementary.io/repo.flatpakrepo 37 | # cache-key: "flatpak-builder-${{ github.sha }}" 38 | -------------------------------------------------------------------------------- /.github/workflows/vala-lint.yml: -------------------------------------------------------------------------------- 1 | name: vala-lint 2 | 3 | on: [push] 4 | 5 | jobs: 6 | lint: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | - uses: elementary/actions/vala-lint@master 13 | with: 14 | dir: src/ 15 | conf: .vala-lint.conf 16 | fail: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .travis.yml 3 | /.flatpak-builder 4 | # gnomeapp.yml 5 | /obj-x86_64-linux-gnu 6 | /debian/.debhelper 7 | /debian/debhelper-build-stamp 8 | /debian/com.github.rajsolai.textsnatcher.debhelper.log 9 | /debian/com.github.rajsolai.textsnatcher.substvars 10 | /debian/com.github.rajsolai.textsnatcher 11 | /debian/files -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | TextSnatcher Gtk App's Version Changelog. 3 | 4 | ## v2.0.0 Major Release [13-03-2022] 5 | ### Added 6 | - Scrot as screenshot engine for X11 systems. 7 | - Option Screen after SnatchNow action. 8 | - Option to use Image from Clipboard. 9 | - German, Dutch and Turkish Language Support added. 10 | 11 | ### Removed 12 | - Tamil, Thai and Hindi Language Support. 13 | 14 | ## v1.0.1 libportal Implementation [02-02-2022] 15 | ### Added 16 | - libportal-0.5 based screenshot backend. 17 | 18 | ### Changed 19 | - io.elementary.Platform version bumped to 6.1 [for elementary OS]. 20 | - DesktopFile category to "Graphics;Scanning;". 21 | 22 | ### Removed 23 | - ScreenShot.vala, ScreenShotProxy.vala. 24 | - Gnome Shell screenshot. 25 | - Flatpak home permission. 26 | - Flatpak xdg-pictures permission. 27 | - Flatpak talk to gnome-shell-dbus permission. 28 | 29 | ## v1.0.0 Initial Release [27-01-2022] 30 | ### Added 31 | - Basic OCR Operations. 32 | - ENG,TAM,RUS,JAP,HIN,SPA,THA,CHI,ARA,FRN Language Support added. 33 | - libhandy-1 based window. 34 | - Uses Tesseract-v4.x. 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Thanks for all the Support shown by Stars, Issues and PRs 💌 ! Currently I'm Saving money for my Linux PC, Soon (next month) the project will be back with updates and fixes

2 | 3 | [![Vala Programming language](https://img.shields.io/badge/Made%20With-Vala%20-A56DE2)](https://wiki.gnome.org/Projects/Vala) 4 | ![Flatpak Build workflow](https://github.com/RajSolai/TextSnatcher/actions/workflows/flatpak-build.yml/badge.svg) 5 | 6 |
7 | 8 |

TextSnatcher

9 |

Copy Text from Images with ease, Perform OCR operations in seconds.

10 | TextSnatcher OCR App for Linux
11 | TextSnatcher - How to copy text from images, answer is TextSnatcher | Product Hunt 12 |
13 | 14 | ## Download 15 | 16 |
17 | Download on Flathub
18 | 19 | Get it on AppCenter 20 |
21 | 22 | ## Features 23 | 24 | - Multiple Language Support. 25 | - Copy Text from images with a Drag. 26 | - Drag over any Image and Paste. 27 | - Fast and Easy to Use. 28 | - This application uses the Tesseract OCR 4.x for the character 29 | recognition. 30 | - Read more about [Tesseract](https://tesseract-ocr.github.io/tessdoc/Home.html) and Star ⭐️ [Tesseract-Project](https://github.com/tesseract-ocr/tesseract). 31 | 32 | ## Screencasts 33 | 34 | https://user-images.githubusercontent.com/54436424/152921719-228485ba-0d37-4b01-864e-63a2792248b5.mp4 35 | 36 | https://user-images.githubusercontent.com/54436424/152921736-c9567c9d-0afa-4c09-8706-6b2a1b6b635a.mp4 37 | 38 | ## Screenshots 39 | 40 | ![TextSnatcher OCR App for Linux](https://raw.githubusercontent.com/RajSolai/TextSnatcher/master/data/screenshots/snap-default.png) 41 | 42 | ![TextSnatcher OCR App for Linux](https://raw.githubusercontent.com/RajSolai/TextSnatcher/master/data/screenshots/snap-dark.png) 43 | 44 | ## Support Me 45 | 46 | Buy Me A Coffee 47 | 48 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R7ABG0F) 49 | 50 | ## Social Media Posts 51 | 52 | [LinkedIn Post on Why I created TextSnatcher](https://www.linkedin.com/posts/solai085_linux-commentbelow-apple-activity-6826408004519374848-wxsw) 53 | 54 | ## Dependencies 55 | 56 | Ensure you have these dependencies installed 57 | 58 | ### Runtime Dependency 59 | 60 | - scrot 61 | - tesseract-ocr 62 | - tesseract language data 63 | [arch repos](https://archlinux.org/packages/community/x86_64/tesseract) 64 | [debian repos](https://packages.debian.org/search?keywords=tesseract-ocr) 65 | 66 | ### Buildtime Dependency 67 | 68 | - granite 69 | - gtk+-3.0 70 | - gobject-2.0 71 | - gdk-pixbuf-2.0 72 | - libhandy-1 73 | - libportal-0.5 74 | 75 | ## Install, build and run 76 | 77 | ```bash 78 | # clone repository 79 | git clone https://github.com/RajSolai/TextSnatcher.git TextSnatcher 80 | # cd to dir 81 | cd TextSnatcher 82 | # run meson 83 | meson build --prefix=/usr 84 | # cd to build, build and test 85 | cd build 86 | sudo ninja install && com.github.rajsolai.textsnatcher 87 | ``` 88 | 89 | ## Inspirations 90 | 91 | - ReadMe: https://github.com/alainm23/planner 92 | - Application Structure: https://github.com/alcadica/develop 93 | - TextSniper (MacOS Application) 94 | 95 | Made with ❤️ for Linux 96 | -------------------------------------------------------------------------------- /com.github.rajsolai.textsnatcher.yml: -------------------------------------------------------------------------------- 1 | app-id: com.github.rajsolai.textsnatcher 2 | 3 | runtime: io.elementary.Platform 4 | runtime-version: "6.1" 5 | sdk: io.elementary.Sdk 6 | command: com.github.rajsolai.textsnatcher 7 | 8 | finish-args: 9 | - "--share=ipc" 10 | - "--socket=fallback-x11" 11 | - "--socket=wayland" 12 | - "--device=dri" 13 | 14 | modules: 15 | - manifests/libportal.yml 16 | - manifests/tesseract.yml 17 | 18 | - name: libbsd 19 | sources: 20 | - type: archive 21 | url: https://libbsd.freedesktop.org/releases/libbsd-0.9.1.tar.xz 22 | sha256: 56d835742327d69faccd16955a60b6dcf30684a8da518c4eca0ac713b9e0a7a4 23 | 24 | - name: imlib2 25 | sources: 26 | - type: git 27 | url: https://github.com/kkoudev/imlib2.git 28 | commit: 0f6782427dd4f49a4d1da03bec133e6a27f994a3 29 | 30 | - name: scrot 31 | sources: 32 | - type: archive 33 | url: https://github.com/resurrecting-open-source-projects/scrot/archive/refs/tags/1.7.tar.gz 34 | sha256: e4ff764f93ea98018d46192c35bd34eeb577040ac6e217aa0d83b2a63d88f66b 35 | 36 | - name: com.github.rajsolai.textsnatcher 37 | buildsystem: meson 38 | sources: 39 | - type: dir 40 | path: . 41 | -------------------------------------------------------------------------------- /data/com.github.rajsolai.textsnatcher.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.github.rajsolai.textsnatcher 5 | CC0-1.0 6 | GPL-3.0+ 7 | TextSnatcher 8 | Snatch Text with just a Drag 9 | 10 |

Copy Text from Images with ease, Perform OCR operations in seconds.

11 |
12 | 13 | com.github.rajsolai.textsnatcher 14 | 15 | Solai Raj (RajSolai) 16 | https://github.com/RajSolai/TextSnatcher 17 | https://github.com/RajSolai/TextSnatcher/issues 18 | https://github.com/RajSolai/TextSnatcher/issues 19 | 20 | 21 | https://raw.githubusercontent.com/RajSolai/TextSnatcher/master/data/screenshots/snap-dark.png 22 | https://raw.githubusercontent.com/RajSolai/TextSnatcher/master/data/screenshots/snap-default.png 23 | 24 | 25 | 26 | 27 | 28 | 29 |

v2.0.0

30 |
    31 |
  • scrot based screenshot backend for X11.
  • 32 |
  • Option to use Image from Clipboard/Files.
  • 33 |
  • German, Dutch and Turkish Language Support added.
  • 34 |
35 |
36 |
37 | 38 | 39 |

v1.0.1

40 |
    41 |
  • libportal-0.5 based screenshot backend.
  • 42 |
  • Usage of minimal permissions.
  • 43 |
44 |
45 |
46 | 47 | 48 |

v1.0.0

49 |
    50 |
  • 51 | Basic OCR Operations. 52 |
  • 53 |
  • 54 | ENG,TAM,RUS,JAP,HIN,SPA,THA,CHI,ARA,FRN Language Support added. 55 |
  • 56 |
  • 57 | libhandy-1 based window. 58 |
  • 59 |
  • 60 | Uses Tesseract-v4.x. 61 |
  • 62 |
63 |
64 |
65 |
66 |
-------------------------------------------------------------------------------- /data/com.github.rajsolai.textsnatcher.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=TextSnatcher 4 | Comment=Snatch Text with just a Drag 5 | GenericName=TextSnatcher 6 | Exec=com.github.rajsolai.textsnatcher %U 7 | Icon=com.github.rajsolai.textsnatcher 8 | Terminal=false 9 | Categories=Graphics;Scanning; 10 | Keywords=TextSnatcher;OCR; 11 | -------------------------------------------------------------------------------- /data/com.github.rajsolai.textsnatcher.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | stylesheet.css 5 | 6 | -------------------------------------------------------------------------------- /data/icons/128/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/16/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/24/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/32/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/48/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/64/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /data/icons/com.github.rajsolai.textsnatcher.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 38 | 42 | 43 | 45 | 48 | 52 | 56 | 57 | 63 | 66 | 70 | 74 | 75 | 78 | 82 | 86 | 87 | 90 | 94 | 98 | 99 | 108 | 118 | 128 | 138 | 147 | 155 | 160 | 166 | 171 | 176 | 182 | 183 | 191 | 196 | 202 | 207 | 212 | 218 | 219 | 227 | 232 | 238 | 243 | 248 | 254 | 255 | 263 | 268 | 274 | 279 | 284 | 290 | 291 | 299 | 303 | 304 | 305 | 309 | 318 | 327 | 334 | 343 | 347 | 351 | 357 | 361 | 365 | Textsn. 376 | 999-999-999-009 387 | 555-555-555-005 398 | No, 99, Some City,Some Country 414 | TextxxxxxxxSnatcherxxxused to xxxread text &numbers inximages xxxx using xxxxxtesseract xOCR programsupports mu-ltiple lan-guage :) 480 | 488 | 489 | 490 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | # Install icons 2 | icon_sizes = ['16', '24', '32', '48', '64', '128'] 3 | 4 | foreach i : icon_sizes 5 | install_data ( 6 | join_paths ('icons', i, meson.project_name () + '.svg'), 7 | install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') 8 | ) 9 | install_data ( 10 | join_paths ('icons', i, meson.project_name () + '.svg'), 11 | install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps') 12 | ) 13 | endforeach 14 | 15 | # Translate and install our .desktop file so the Applications Menu will see it 16 | i18n.merge_file ( 17 | input: meson.project_name () + '.desktop.in', 18 | output: meson.project_name () + '.desktop', 19 | po_dir: join_paths (meson.source_root (), 'po', 'extra'), 20 | type: 'desktop', 21 | install: true, 22 | install_dir: join_paths (get_option ('datadir'), 'applications') 23 | ) 24 | 25 | # Translate and install our .appdata.xml file so AppCenter will see it 26 | i18n.merge_file ( 27 | input: meson.project_name () + '.appdata.xml.in', 28 | output: meson.project_name () + '.appdata.xml', 29 | po_dir: join_paths (meson.source_root (), 'po', 'extra'), 30 | install: true, 31 | install_dir: join_paths (get_option ('datadir'), 'metainfo') 32 | ) 33 | -------------------------------------------------------------------------------- /data/screenshots/snap-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RajSolai/TextSnatcher/1d7e059e3639acf42db05f20e33ba75a6b9b8b23/data/screenshots/snap-dark.png -------------------------------------------------------------------------------- /data/screenshots/snap-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RajSolai/TextSnatcher/1d7e059e3639acf42db05f20e33ba75a6b9b8b23/data/screenshots/snap-default.png -------------------------------------------------------------------------------- /data/stylesheet.css: -------------------------------------------------------------------------------- 1 | .h2 { 2 | font-size: 24px; 3 | } 4 | 5 | header .header { 6 | background-color: transparent; 7 | } 8 | 9 | .select-pic-box { 10 | padding: 1rem; 11 | } 12 | 13 | .header { 14 | padding: 0.2rem; 15 | } 16 | 17 | .dialog-title { 18 | font-weight: bold; 19 | font-size: 18px; 20 | } 21 | -------------------------------------------------------------------------------- /data/textsnatcher-banner.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 37 | 39 | 47 | 52 | 58 | 63 | 68 | 74 | 75 | 80 | 83 | 87 | 91 | 92 | 98 | 101 | 105 | 109 | 110 | 113 | 117 | 121 | 122 | 125 | 129 | 133 | 134 | 143 | 153 | 163 | 173 | 182 | 190 | 195 | 201 | 206 | 211 | 217 | 218 | 226 | 231 | 237 | 242 | 247 | 253 | 254 | 262 | 267 | 273 | 278 | 283 | 289 | 290 | 298 | 303 | 309 | 314 | 319 | 325 | 326 | 334 | 338 | 339 | 347 | 352 | 358 | 363 | 368 | 374 | 375 | 376 | 380 | 389 | 394 | 403 | 412 | 419 | 428 | 432 | 436 | 442 | 446 | 450 | Textsn. 461 | 999-999-999-009 472 | 555-555-555-005 483 | No, 99, Some City,Some Country 499 | TextxxxxxxxSnatcherxxxused to xxxread text &numbers inximages xxxx using xxxxxtesseract xOCR programsupports mu-ltiple lan-guage :) 565 | 573 | 574 | TextSnatcher 585 | Copy Text from Images with ease, Perform OCR operations in seconds. 601 | 602 | 603 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | com.github.rajsolai.textsnatcher (1.0.0) UNRELEASED; urgency=medium 2 | 3 | * Initial Release. 4 | 5 | -- solairaj Mon, 31 Jan 2022 10:35:12 +0530 6 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: com.github.rajsolai.textsnatcher 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Solai Raj 5 | Build-Depends: debhelper-compat (= 12), 6 | meson, 7 | valac, 8 | libglib2.0-dev, 9 | libgtk-3-dev, 10 | libgranite-dev, 11 | libhandy-1-dev, 12 | libgdk-pixbuf-2.0-dev, 13 | libgirepository1.0-dev, 14 | libportal-dev 15 | Standards-Version: 4.4.1 16 | Homepage: https://github.com/RajSolai/TextSnatcher 17 | Vcs-Browser: https://github.com/RajSolai/TextSnatcher 18 | Vcs-Git: https://github.com/RajSolai/TextSnatcher.git 19 | 20 | Package: com.github.rajsolai.textsnatcher 21 | Architecture: any 22 | Depends: ${misc:Depends}, 23 | tesseract-ocr (>= 4.0.0), 24 | tesseract-ocr-tha, 25 | tesseract-ocr-tam, 26 | tesseract-ocr-eng, 27 | tesseract-ocr-hin, 28 | tesseract-ocr-jpn, 29 | tesseract-ocr-ara, 30 | tesseract-ocr-rus, 31 | tesseract-ocr-fra, 32 | tesseract-ocr-chi-sim, 33 | tesseract-ocr-spa 34 | Description: Snatch Text with just a Drag 35 | Multiple Language Support. 36 | Copy Text from images with a Drag. 37 | Drag over any Image and Paste. 38 | Fast and Easy to Use. 39 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: com.github.rajsolai.textsnatcher 3 | Upstream-Contact: Solai Raj 4 | Source: https://github.com/RajSolai/TextSnatcher 5 | 6 | Files: * 7 | Copyright: 2022 Solai Raj 8 | License: GPL-3 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, version 3. 12 | . 13 | This package is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | . 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | . 21 | On Debian systems, the complete text of the GNU General 22 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". 23 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | #export DH_VERBOSE = 1 5 | 6 | 7 | # see FEATURE AREAS in dpkg-buildflags(1) 8 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 9 | 10 | # see ENVIRONMENT in dpkg-buildflags(1) 11 | # package maintainers to append CFLAGS 12 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 13 | # package maintainers to append LDFLAGS 14 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 15 | 16 | override_dh_strip_nondeterminism: 17 | 18 | %: 19 | dh $@ 20 | # dh_make generated override targets 21 | # This is example for Cmake (See https://bugs.debian.org/641051 ) 22 | #override_dh_auto_configure: 23 | # dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) 24 | 25 | override_dh_shlibdeps: 26 | dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /fbuild.sh: -------------------------------------------------------------------------------- 1 | flatpak-builder build --install --user --force-clean ./gnomeapp.yml 2 | 3 | -------------------------------------------------------------------------------- /format.sh: -------------------------------------------------------------------------------- 1 | find . -name "*.vala" | uncrustify -F - --replace --no-backup -c $HOME/Documents/vala.cfg 2 | 3 | -------------------------------------------------------------------------------- /gensha.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | langs = ['tam','eng','hin','jpn','rus','fra','tha','ara','chi_sim','spa', 'ind'] 4 | 5 | for lang in langs : 6 | file_url = 'https://github.com/tesseract-ocr/tessdata_best/raw/main/'+lang+'.traineddata' 7 | subprocess.run(['wget',file_url,'-P','/tmp']) 8 | 9 | for lang in langs : 10 | file_path = '/tmp/'+lang+'.traineddata' 11 | subprocess.run(['sha256sum',file_path]) 12 | -------------------------------------------------------------------------------- /gnomeapp.yml: -------------------------------------------------------------------------------- 1 | app-id: com.github.rajsolai.textsnatcher 2 | 3 | runtime: org.gnome.Platform 4 | runtime-version: "41" 5 | base: io.elementary.BaseApp 6 | base-version: "juno-21.08" 7 | sdk: org.gnome.Sdk 8 | command: com.github.rajsolai.textsnatcher 9 | 10 | finish-args: 11 | - "--share=ipc" 12 | - "--socket=fallback-x11" 13 | - "--socket=wayland" 14 | - "--device=dri" 15 | - "--system-talk-name=org.freedesktop.Accounts" 16 | 17 | modules: 18 | - name: libbsd 19 | sources: 20 | - type: archive 21 | url: https://libbsd.freedesktop.org/releases/libbsd-0.9.1.tar.xz 22 | sha256: 56d835742327d69faccd16955a60b6dcf30684a8da518c4eca0ac713b9e0a7a4 23 | 24 | - name: imlib2 25 | sources: 26 | - type: git 27 | url: https://github.com/kkoudev/imlib2.git 28 | commit: 0f6782427dd4f49a4d1da03bec133e6a27f994a3 29 | 30 | - name: scrot 31 | sources: 32 | - type: archive 33 | url: https://github.com/resurrecting-open-source-projects/scrot/archive/refs/tags/1.7.tar.gz 34 | sha256: e4ff764f93ea98018d46192c35bd34eeb577040ac6e217aa0d83b2a63d88f66b 35 | 36 | - name: libportal 37 | buildsystem: meson 38 | builddir: true 39 | config-opts: 40 | - "-Dbackends=gtk3" 41 | - "-Ddocs=false" 42 | sources: 43 | - type: archive 44 | url: https://github.com/flatpak/libportal/releases/download/0.5/libportal-0.5.tar.xz 45 | sha256: d8c8cb18a34e5eeb26a39c94044c955995b01de0e139caac5e18c076cf821b3b 46 | 47 | - name: com.github.rajsolai.textsnatcher 48 | buildsystem: meson 49 | sources: 50 | - type: dir 51 | #url: https://github.com/RajSolai/TextSnatcher/archive/refs/tags/v1.0.1.tar.gz 52 | #sha256: 29d39bcf4b0ed0b16f932cfd5553a280907df75d8332979f6504e7946ed5c356 53 | path: . 54 | 55 | - name: leptonica 56 | rm-configure: true 57 | config-opts: 58 | - --disable-static 59 | sources: 60 | - type: archive 61 | url: https://github.com/DanBloomberg/leptonica/releases/download/1.79.0/leptonica-1.79.0.tar.gz 62 | sha256: 045966c9c5d60ebded314a9931007a56d9d2f7a6ac39cb5cc077c816f62300d8 63 | 64 | - name: tesseract 65 | config-opts: 66 | - --disable-static 67 | - --disable-graphics 68 | - --enable-legacy 69 | sources: 70 | - type: archive 71 | url: https://github.com/tesseract-ocr/tesseract/archive/4.1.1.tar.gz 72 | sha256: 2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb 73 | - type: file 74 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/eng.traineddata 75 | sha256: 8280aed0782fe27257a68ea10fe7ef324ca0f8d85bd2fd145d1c2b560bcb66ba 76 | dest: traineddata 77 | - type: file 78 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/jpn.traineddata 79 | sha256: 36bdf9ac823f5911e624c30d0553e890b8abc7c31a65b3ef14da943658c40b79 80 | dest: traineddata 81 | - type: file 82 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/rus.traineddata 83 | sha256: b617eb6830ffabaaa795dd87ea7fd251adfe9cf0efe05eb9a2e8128b7728d6b6 84 | dest: traineddata 85 | - type: file 86 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/fra.traineddata 87 | sha256: 907743d98915c91a3906dfbf6e48b97598346698fe53aaa797e1a064ffcac913 88 | dest: traineddata 89 | - type: file 90 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/ara.traineddata 91 | sha256: ab9d157d8e38ca00e7e39c7d5363a5239e053f5b0dbdb3167dde9d8124335896 92 | dest: traineddata 93 | - type: file 94 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/chi_sim.traineddata 95 | sha256: 4fef2d1306c8e87616d4d3e4c6c67faf5d44be3342290cf8f2f0f6e3aa7e735b 96 | dest: traineddata 97 | - type: file 98 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/spa.traineddata 99 | sha256: e2c1ffdad8b30f26c45d4017a9183d3a7f9aa69e59918be4f88b126fac99ab2c 100 | dest: traineddata 101 | - type: file 102 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/tur.traineddata 103 | sha256: e0c3338dc17503dc7d335a507c9ae01b2b46cfd07561171e1e1ac55d85e8e438 104 | dest: traineddata 105 | - type: file 106 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/nld.traineddata 107 | sha256: 92e7a1ad4bf8082e268de57c7823316ec024935702c6ed2a1e473b3a071aa733 108 | dest: traineddata 109 | - type: file 110 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/deu.traineddata 111 | sha256: 8407331d6aa0229dc927685c01a7938fc5a641d1a9524f74838cdac599f0d06e 112 | dest: traineddata 113 | - type: file 114 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/ind.traineddata 115 | sha256: 1f6596041ffb4cd5094e5f98764db43cfde04edb8f02b988f90ebc1353ac73b8 116 | dest: traineddata 117 | 118 | post-install: 119 | - install -p -D -m 0644 "traineddata"/deu.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 120 | - install -p -D -m 0644 "traineddata"/nld.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 121 | - install -p -D -m 0644 "traineddata"/tur.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 122 | - install -p -D -m 0644 "traineddata"/eng.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 123 | - install -p -D -m 0644 "traineddata"/jpn.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 124 | - install -p -D -m 0644 "traineddata"/rus.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 125 | - install -p -D -m 0644 "traineddata"/fra.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 126 | - install -p -D -m 0644 "traineddata"/ara.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 127 | - install -p -D -m 0644 "traineddata"/chi_sim.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 128 | - install -p -D -m 0644 "traineddata"/spa.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 129 | - install -p -D -m 0644 "traineddata"/ind.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 130 | -------------------------------------------------------------------------------- /manifests/leptonica.yml: -------------------------------------------------------------------------------- 1 | name: leptonica 2 | rm-configure: true 3 | config-opts: 4 | - --disable-static 5 | sources: 6 | - type: archive 7 | url: https://github.com/DanBloomberg/leptonica/releases/download/1.79.0/leptonica-1.79.0.tar.gz 8 | sha256: 045966c9c5d60ebded314a9931007a56d9d2f7a6ac39cb5cc077c816f62300d8 -------------------------------------------------------------------------------- /manifests/libportal.yml: -------------------------------------------------------------------------------- 1 | name: libportal 2 | buildsystem: meson 3 | builddir: true 4 | config-opts: 5 | - "-Dbackends=gtk3" 6 | - "-Ddocs=false" 7 | sources: 8 | - type: archive 9 | url: https://github.com/flatpak/libportal/releases/download/0.5/libportal-0.5.tar.xz 10 | sha256: d8c8cb18a34e5eeb26a39c94044c955995b01de0e139caac5e18c076cf821b3b 11 | -------------------------------------------------------------------------------- /manifests/tesseract.yml: -------------------------------------------------------------------------------- 1 | name: tesseract 2 | config-opts: 3 | - --disable-static 4 | - --disable-graphics 5 | - --enable-legacy 6 | sources: 7 | - type: archive 8 | url: https://github.com/tesseract-ocr/tesseract/archive/4.1.1.tar.gz 9 | sha256: 2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb 10 | - type: file 11 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/eng.traineddata 12 | sha256: 8280aed0782fe27257a68ea10fe7ef324ca0f8d85bd2fd145d1c2b560bcb66ba 13 | dest: traineddata 14 | - type: file 15 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/jpn.traineddata 16 | sha256: 36bdf9ac823f5911e624c30d0553e890b8abc7c31a65b3ef14da943658c40b79 17 | dest: traineddata 18 | - type: file 19 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/rus.traineddata 20 | sha256: b617eb6830ffabaaa795dd87ea7fd251adfe9cf0efe05eb9a2e8128b7728d6b6 21 | dest: traineddata 22 | - type: file 23 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/fra.traineddata 24 | sha256: 907743d98915c91a3906dfbf6e48b97598346698fe53aaa797e1a064ffcac913 25 | dest: traineddata 26 | - type: file 27 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/ara.traineddata 28 | sha256: ab9d157d8e38ca00e7e39c7d5363a5239e053f5b0dbdb3167dde9d8124335896 29 | dest: traineddata 30 | - type: file 31 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/chi_sim.traineddata 32 | sha256: 4fef2d1306c8e87616d4d3e4c6c67faf5d44be3342290cf8f2f0f6e3aa7e735b 33 | dest: traineddata 34 | - type: file 35 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/spa.traineddata 36 | sha256: e2c1ffdad8b30f26c45d4017a9183d3a7f9aa69e59918be4f88b126fac99ab2c 37 | dest: traineddata 38 | - type: file 39 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/tur.traineddata 40 | sha256: e0c3338dc17503dc7d335a507c9ae01b2b46cfd07561171e1e1ac55d85e8e438 41 | dest: traineddata 42 | - type: file 43 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/nld.traineddata 44 | sha256: 92e7a1ad4bf8082e268de57c7823316ec024935702c6ed2a1e473b3a071aa733 45 | dest: traineddata 46 | - type: file 47 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/deu.traineddata 48 | sha256: 8407331d6aa0229dc927685c01a7938fc5a641d1a9524f74838cdac599f0d06e 49 | dest: traineddata 50 | - type: file 51 | url: https://github.com/tesseract-ocr/tessdata_best/raw/main/ind.traineddata 52 | sha256: 1f6596041ffb4cd5094e5f98764db43cfde04edb8f02b988f90ebc1353ac73b8 53 | dest: traineddata 54 | 55 | post-install: 56 | - install -p -D -m 0644 "traineddata"/eng.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 57 | - install -p -D -m 0644 "traineddata"/jpn.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 58 | - install -p -D -m 0644 "traineddata"/deu.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 59 | - install -p -D -m 0644 "traineddata"/rus.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 60 | - install -p -D -m 0644 "traineddata"/fra.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 61 | - install -p -D -m 0644 "traineddata"/ara.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 62 | - install -p -D -m 0644 "traineddata"/chi_sim.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 63 | - install -p -D -m 0644 "traineddata"/spa.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 64 | - install -p -D -m 0644 "traineddata"/nld.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 65 | - install -p -D -m 0644 "traineddata"/tur.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 66 | - install -p -D -m 0644 "traineddata"/ind.traineddata -t "${FLATPAK_DEST}/share/tessdata/"; 67 | 68 | 69 | modules: 70 | - leptonica.yml 71 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | # Project name, programming language and version 2 | project ( 3 | 'com.github.rajsolai.textsnatcher', 4 | 'vala', 'c', 5 | version: '2.0' 6 | ) 7 | 8 | # Translation module 9 | i18n = import ('i18n') 10 | gnome = import ('gnome') 11 | 12 | # Project arguments 13 | add_project_arguments ( 14 | '-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name ()), 15 | language: 'c' 16 | ) 17 | 18 | # Listing dependencies 19 | dependencies = [ 20 | dependency('granite'), 21 | dependency('gobject-2.0'), 22 | dependency('libhandy-1'), 23 | dependency('libportal'), 24 | dependency('gdk-pixbuf-2.0'), 25 | dependency('glib-2.0'), 26 | dependency('gtk+-3.0') 27 | ] 28 | 29 | subdir ('src') 30 | 31 | # for resources 32 | as_resources = gnome.compile_resources ( 33 | 'as-resources', 'data/' + meson.project_name() + '.gresource.xml', 34 | source_dir: 'data', 35 | c_name: 'as' 36 | ) 37 | 38 | 39 | # Executable 40 | executable ( 41 | meson.project_name (), 42 | sources, 43 | as_resources, 44 | dependencies: dependencies, 45 | install: true 46 | ) 47 | 48 | subdir ('data') 49 | subdir ('po') 50 | 51 | meson.add_install_script ('meson/post_install.py') 52 | -------------------------------------------------------------------------------- /meson/post_install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from os import path, environ 4 | import subprocess 5 | 6 | prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') 7 | schemadir = path.join(environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') 8 | datadir = path.join(prefix, 'share') 9 | desktop_database_dir = path.join(datadir, 'applications') 10 | 11 | if not environ.get('DESTDIR'): 12 | print('Compiling gsettings schemas…') 13 | subprocess.call(['glib-compile-schemas', schemadir]) 14 | print('Updating desktop database…') 15 | subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) 16 | print('Updating icon cache…') 17 | subprocess.call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) 18 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RajSolai/TextSnatcher/1d7e059e3639acf42db05f20e33ba75a6b9b8b23/po/LINGUAS -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | src/Application.vala 2 | -------------------------------------------------------------------------------- /po/extra/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RajSolai/TextSnatcher/1d7e059e3639acf42db05f20e33ba75a6b9b8b23/po/extra/LINGUAS -------------------------------------------------------------------------------- /po/extra/POTFILES: -------------------------------------------------------------------------------- 1 | data/com.github.rajsolai.textsnatcher.desktop.in 2 | data/com.github.rajsolai.textsnatcher.appdata.xml.in 3 | -------------------------------------------------------------------------------- /po/extra/meson.build: -------------------------------------------------------------------------------- 1 | # Install metadata translations 2 | i18n.gettext ('extra', 3 | args: [ 4 | '--directory=' + meson.source_root (), 5 | '--from-code=UTF-8' 6 | ], 7 | install: false 8 | ) 9 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | # Install main translations 2 | i18n.gettext (meson.project_name (), 3 | args: [ 4 | '--directory=' + meson.source_root (), 5 | '--from-code=UTF-8' 6 | ], 7 | preset: 'glib' 8 | ) 9 | 10 | subdir ('extra') 11 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | cd build && ninja install && com.github.rajsolai.textsnatcher -------------------------------------------------------------------------------- /src/Application.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 - Today Solai Raj (github.com/RajSolai) 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public 15 | * License along with this program; if not, write to the 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | * Boston, MA 02110-1301 USA 18 | * 19 | * Authored by: Solai Raj 20 | */ 21 | 22 | public class Application : Gtk.Application { 23 | MainWindow main_window ; 24 | 25 | public Application () { 26 | Object ( 27 | application_id: "com.github.rajsolai.textsnatcher", 28 | flags : ApplicationFlags.FLAGS_NONE 29 | ) ; 30 | } 31 | 32 | protected override void activate () { 33 | weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default () ; 34 | default_theme.add_resource_path ("/com/github/rajsolai/TextSnatcher") ; 35 | 36 | // stylesheet 37 | var provider = new Gtk.CssProvider () ; 38 | provider.load_from_resource ("/com/github/rajsolai/TextSnatcher/stylesheet.css") ; 39 | Gtk.StyleContext.add_provider_for_screen ( 40 | Gdk.Screen.get_default (), 41 | provider, 42 | Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION 43 | ) ; 44 | 45 | var granite_settings = Granite.Settings.get_default () ; 46 | var gtk_settings = Gtk.Settings.get_default () ; 47 | 48 | if (granite_settings != null) { 49 | gtk_settings.gtk_application_prefer_dark_theme = 50 | granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK ; 51 | 52 | granite_settings.notify["prefers-color-scheme"].connect (() => { 53 | gtk_settings.gtk_application_prefer_dark_theme = 54 | granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK ; 55 | }) ; 56 | } 57 | 58 | main_window = new MainWindow (this) ; 59 | add_window (main_window) ; 60 | } 61 | 62 | public static int main (string[] args) { 63 | var app = new Application () ; 64 | return app.run (args) ; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/MainWindow.vala: -------------------------------------------------------------------------------- 1 | public class MainWindow : Hdy.ApplicationWindow { 2 | public MainWindow (Gtk.Application app) { 3 | var window_handle = new Hdy.WindowHandle () ; 4 | var window_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) ; 5 | var main_screen = new MainScreen () ; 6 | var header_bar = new CustomHeaderBar () ; 7 | default_height = 150 ; 8 | default_width = 300 ; 9 | get_style_context ().add_class ("rounded") ; 10 | get_style_context ().add_class ("main-window") ; 11 | window_box.add (header_bar) ; 12 | window_box.add (main_screen) ; 13 | window_handle.add (window_box) ; 14 | add (window_handle) ; 15 | show_all () ; 16 | } 17 | 18 | construct { 19 | Hdy.init () ; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/components/AboutButton.vala: -------------------------------------------------------------------------------- 1 | class AboutButton : Gtk.Button { 2 | TsAboutDialog about_dialog ; 3 | public AboutButton () { 4 | Object ( 5 | image: new Gtk.Image.from_icon_name ( 6 | "dialog-information-symbolic", Gtk.IconSize.SMALL_TOOLBAR 7 | ) 8 | ) ; 9 | clicked.connect (() => { 10 | about_dialog = new TsAboutDialog () ; 11 | }) ; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/components/AboutDialog.vala: -------------------------------------------------------------------------------- 1 | class TsAboutDialog : Gtk.AboutDialog { 2 | construct { 3 | set_destroy_with_parent (true) ; 4 | set_modal (true) ; 5 | 6 | artists = null ; 7 | authors = { "Solai Raj (RajSolai)", "msraj085@gmail.com" } ; 8 | documenters = null ; 9 | translator_credits = null ; 10 | logo_icon_name = "com.github.rajsolai.textsnatcher" ; 11 | 12 | program_name = "TextSnatcher" ; 13 | comments = "Snatch Text with a Drag" ; 14 | copyright = null ; 15 | version = "2.0" ; 16 | 17 | license = null ; 18 | wrap_license = true ; 19 | 20 | website = "https://github.com/RajSolai/TextSnatcher" ; 21 | website_label = "Star TextSnatcher on Github !" ; 22 | 23 | response.connect ((response_id) => { 24 | if (response_id == Gtk.ResponseType.CANCEL || response_id == Gtk.ResponseType.DELETE_EVENT) { 25 | hide () ; 26 | } 27 | }) ; 28 | 29 | present () ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/components/HeaderBar.vala: -------------------------------------------------------------------------------- 1 | public class CustomHeaderBar : Hdy.HeaderBar { 2 | 3 | public CustomHeaderBar () { 4 | var language_button = new LanguageButton () ; 5 | var about_button = new AboutButton () ; 6 | get_style_context ().add_class ("default-decoration") ; 7 | get_style_context ().add_class ("flat") ; 8 | get_style_context ().add_class ("header") ; 9 | pack_start (language_button) ; 10 | pack_end (about_button) ; 11 | decoration_layout = "close:" ; 12 | title = "TextSnatcher" ; 13 | set_show_close_button (true) ; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/components/LanguageButton.vala: -------------------------------------------------------------------------------- 1 | public class LanguageButton : Gtk.MenuButton { 2 | public LanguageButton () { 3 | Object ( 4 | image: new Gtk.Image.from_icon_name ("preferences-desktop-locale", Gtk.IconSize.SMALL_TOOLBAR) 5 | ) ; 6 | var menu_list = new Gtk.Box (Gtk.Orientation.VERTICAL, 5) ; 7 | var scroll_view = new Gtk.ScrolledWindow (null, null) ; 8 | scroll_view.height_request = 190 ; 9 | scroll_view.width_request = 150 ; 10 | var lang = new LanguageService () ; 11 | var spa = new Gtk.ModelButton () ; 12 | var eng = new Gtk.ModelButton () ; 13 | var chi_sim = new Gtk.ModelButton () ; 14 | var jpn = new Gtk.ModelButton () ; 15 | var rus = new Gtk.ModelButton () ; 16 | var fra = new Gtk.ModelButton () ; 17 | var ara = new Gtk.ModelButton () ; 18 | var nld = new Gtk.ModelButton () ; // Dutch Language is represented as nld 19 | var tur = new Gtk.ModelButton () ; 20 | var deu = new Gtk.ModelButton () ; 21 | var ind = new Gtk.ModelButton () ; 22 | 23 | deu.text = "German" ; 24 | nld.text = "Dutch" ; 25 | tur.text = "Turkish" ; 26 | eng.text = "English" ; 27 | spa.text = "Spanish" ; 28 | chi_sim.text = "Chinese (Simplified)" ; 29 | jpn.text = "Japanese" ; 30 | rus.text = "Russian" ; 31 | fra.text = "French" ; 32 | ara.text = "Arabic" ; 33 | ind.text = "Indonesian" ; 34 | 35 | deu.clicked.connect (() => { lang.save_pref_language ("deu") ; }) ; 36 | eng.clicked.connect (() => { lang.save_pref_language ("eng") ; }) ; 37 | chi_sim.clicked.connect (() => { lang.save_pref_language ("chi_sim") ; }) ; 38 | jpn.clicked.connect (() => { lang.save_pref_language ("jpn") ; }) ; 39 | fra.clicked.connect (() => { lang.save_pref_language ("fra") ; }) ; 40 | rus.clicked.connect (() => { lang.save_pref_language ("rus") ; }) ; 41 | ara.clicked.connect (() => { lang.save_pref_language ("ara") ; }) ; 42 | spa.clicked.connect (() => { lang.save_pref_language ("spa") ; }) ; 43 | nld.clicked.connect (() => { lang.save_pref_language ("nld") ; }) ; 44 | tur.clicked.connect (() => { lang.save_pref_language ("tur") ; }) ; 45 | ind.clicked.connect (() => { lang.save_pref_language ("ind") ; }) ; 46 | 47 | menu_list.add (eng) ; 48 | menu_list.add (chi_sim) ; 49 | menu_list.add (jpn) ; 50 | menu_list.add (nld) ; 51 | menu_list.add (deu) ; 52 | menu_list.add (fra) ; 53 | menu_list.add (ara) ; 54 | menu_list.add (tur) ; 55 | menu_list.add (rus) ; 56 | menu_list.add (ind) ; 57 | 58 | scroll_view.add (menu_list) ; 59 | scroll_view.show_all () ; 60 | var popover = new Gtk.Popover (null) ; 61 | popover.add (scroll_view) ; 62 | this.popover = popover ; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/components/SelectPictureDialog.vala: -------------------------------------------------------------------------------- 1 | class SelectPictureDialog : Hdy.Window { 2 | public SelectPictureDialog (Gtk.Label title_label) { 3 | var dialog_handle = new Hdy.WindowHandle () ; 4 | var pic_dialog_title = new Gtk.Label ("Where can I find the Image ?") ; 5 | var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10) ; 6 | var cancel_btn = new Gtk.Button.with_label ("Cancel") ; 7 | var take_screenshot_btn = new Gtk.Button.with_label ("Take Screenshot") ; 8 | var choose_file_btn = new Gtk.Button.with_label ("Choose File") ; 9 | var from_clipb_btn = new Gtk.Button.with_label ("Get from Clipboard") ; 10 | 11 | default_height = 200 ; 12 | default_width = 200 ; 13 | set_position (Gtk.WindowPosition.MOUSE) ; 14 | 15 | main_box.get_style_context ().add_class ("select-pic-box") ; 16 | pic_dialog_title.get_style_context ().add_class ("dialog-title") ; 17 | 18 | choose_file_btn.clicked.connect (() => { 19 | hide () ; 20 | perform_signal ("file") ; 21 | }) ; 22 | 23 | take_screenshot_btn.clicked.connect (() => { 24 | hide () ; 25 | perform_signal ("shot") ; 26 | }) ; 27 | 28 | from_clipb_btn.clicked.connect (() => { 29 | hide () ; 30 | perform_signal ("clip") ; 31 | }) ; 32 | 33 | cancel_btn.clicked.connect (() => { 34 | cancel_signal () ; 35 | }) ; 36 | 37 | main_box.add (pic_dialog_title) ; 38 | main_box.add (take_screenshot_btn) ; 39 | main_box.add (choose_file_btn) ; 40 | main_box.add (from_clipb_btn) ; 41 | main_box.add (cancel_btn) ; 42 | dialog_handle.add (main_box) ; 43 | add (dialog_handle) ; 44 | } 45 | 46 | construct { 47 | Hdy.init () ; 48 | } 49 | 50 | public signal void cancel_signal () ; 51 | public signal void perform_signal (string image_source) ; 52 | } 53 | -------------------------------------------------------------------------------- /src/components/VerticalBox.vala: -------------------------------------------------------------------------------- 1 | class VerticalBox : Gtk.Box { 2 | public VerticalBox (int space) { 3 | Object ( 4 | orientation: Gtk.Orientation.VERTICAL, 5 | spacing: space 6 | ) ; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | # Listing files to compile 2 | sources = files ( 3 | 'Application.vala', 4 | 'MainWindow.vala', 5 | 'components/VerticalBox.vala', 6 | 'components/HeaderBar.vala', 7 | 'components/LanguageButton.vala', 8 | 'components/AboutButton.vala', 9 | 'components/AboutDialog.vala', 10 | 'components/SelectPictureDialog.vala', 11 | 'screens/MainScreen.vala', 12 | 'screens/HomeScreen.vala', 13 | 'screens/SelectPictureScreen.vala', 14 | 'services/LanguageService.vala', 15 | 'services/TesseractTrigger.vala' 16 | ) 17 | -------------------------------------------------------------------------------- /src/screens/HomeScreen.vala: -------------------------------------------------------------------------------- 1 | class HomeScreen : Gtk.EventBox { 2 | public Gtk.Label title_label ; 3 | public HomeScreen () { 4 | var is_select_dialog_opened = false ; 5 | var tesseract_trigger = new TesseractTrigger () ; 6 | var main_box = new Gtk.Grid () ; 7 | var vbox = new VerticalBox (4) ; 8 | title_label = new Gtk.Label ("TextSnatcher") ; 9 | main_box.column_homogeneous = true ; 10 | main_box.row_homogeneous = true ; 11 | main_box.margin = 10 ; 12 | title_label.get_style_context ().add_class ("h2") ; 13 | var start_button = new Gtk.Button.with_label ("Snatch Now !") ; 14 | start_button.get_style_context ().add_class ("start-button") ; 15 | 16 | start_button.clicked.connect (() => { 17 | string arg = Environment.get_variable ("XDG_SESSION_TYPE") ; 18 | goto_select_screen () ; 19 | }) ; 20 | main_box.orientation = Gtk.Orientation.VERTICAL ; 21 | vbox.pack_start (title_label, true, true, 5) ; 22 | vbox.pack_start (start_button, true, true, 5) ; 23 | main_box.add (vbox) ; 24 | // main_box.show_all () ; 25 | add (main_box) ; 26 | } 27 | 28 | public signal void goto_select_screen () ; 29 | } 30 | -------------------------------------------------------------------------------- /src/screens/MainScreen.vala: -------------------------------------------------------------------------------- 1 | public class MainScreen : Gtk.EventBox { 2 | TesseractTrigger tesseract_trigger ; 3 | public MainScreen () { 4 | tesseract_trigger = new TesseractTrigger () ; 5 | var main_stack = new Gtk.Stack () ; 6 | var home_screen = new HomeScreen () ; 7 | var select_picture_screen = new SelectPictureScreen () ; 8 | var title_label = home_screen.title_label ; 9 | var dummmy = new Gtk.Label ("") ; 10 | 11 | // main_stack.vhomogeneous = false; 12 | main_stack.transition_type = Gtk.StackTransitionType.SLIDE_UP_DOWN ; 13 | main_stack.add_named (home_screen, "home_screen") ; 14 | main_stack.add_named (select_picture_screen, "select_picture_screen") ; 15 | 16 | home_screen.goto_select_screen.connect (() => { 17 | main_stack.visible_child_name = "select_picture_screen" ; 18 | }) ; 19 | 20 | select_picture_screen.cancel_signal.connect (() => { 21 | main_stack.visible_child_name = "home_screen" ; 22 | }) ; 23 | 24 | select_picture_screen.perform_signal.connect ((image_source) => { 25 | main_stack.visible_child_name = "home_screen" ; 26 | perform_operation (title_label, image_source) ; 27 | }) ; 28 | 29 | add (main_stack) ; 30 | } 31 | 32 | void perform_operation (Gtk.Label title_label, string image_source) { 33 | tesseract_trigger.start_tess_process.begin (title_label, image_source, (obj, res) => { 34 | return ; 35 | }) ; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/screens/SelectPictureScreen.vala: -------------------------------------------------------------------------------- 1 | class SelectPictureScreen : Gtk.EventBox { 2 | TesseractTrigger tesseract_trigger ; 3 | public SelectPictureScreen () { 4 | tesseract_trigger = new TesseractTrigger () ; 5 | var pic_dialog_title = new Gtk.Label ("Where can I find the Image ?") ; 6 | var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10) ; 7 | var cancel_btn = new Gtk.Button.with_label ("Cancel") ; 8 | var take_screenshot_btn = new Gtk.Button.with_label ("Take Screenshot") ; 9 | var choose_file_btn = new Gtk.Button.with_label ("Choose File") ; 10 | var from_clipb_btn = new Gtk.Button.with_label ("Get from Clipboard") ; 11 | 12 | 13 | main_box.get_style_context ().add_class ("select-pic-box") ; 14 | pic_dialog_title.get_style_context ().add_class ("dialog-title") ; 15 | 16 | 17 | choose_file_btn.clicked.connect (() => { 18 | perform_signal ("file") ; 19 | }) ; 20 | 21 | take_screenshot_btn.clicked.connect (() => { 22 | perform_signal ("shot") ; 23 | }) ; 24 | 25 | from_clipb_btn.clicked.connect (() => { 26 | perform_signal ("clip") ; 27 | }) ; 28 | 29 | cancel_btn.clicked.connect (() => { 30 | cancel_signal () ; 31 | }) ; 32 | 33 | main_box.add (pic_dialog_title) ; 34 | main_box.add (take_screenshot_btn) ; 35 | main_box.add (choose_file_btn) ; 36 | main_box.add (from_clipb_btn) ; 37 | main_box.add (cancel_btn) ; 38 | add (main_box) ; 39 | } 40 | 41 | public signal void cancel_signal () ; 42 | public signal void perform_signal (string image_source) ; 43 | } 44 | -------------------------------------------------------------------------------- /src/services/LanguageService.vala: -------------------------------------------------------------------------------- 1 | class LanguageService { 2 | static string preferred_language = "eng" ; 3 | 4 | public void save_pref_language (string language) { 5 | preferred_language = language ; 6 | } 7 | 8 | public string get_pref_language () { 9 | return preferred_language ; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/services/TesseractTrigger.vala: -------------------------------------------------------------------------------- 1 | class TesseractTrigger : Object { 2 | string out_path = GLib.Environment.get_home_dir () + "/.textsnatcher" ; 3 | string scrot_path = GLib.Environment.get_tmp_dir () + "/textshot.png" ; 4 | Gtk.Clipboard clipboard ; 5 | string res ; 6 | string err ; 7 | int stat ; 8 | Gdk.Display display = Gdk.Display.get_default () ; 9 | Gtk.Label label ; 10 | Xdp.Portal portal ; 11 | 12 | construct { 13 | portal = new Xdp.Portal () ; 14 | clipboard = Gtk.Clipboard.get_default (display) ; 15 | } 16 | 17 | public void accept_files_fromchooser () { 18 | portal.open_file.begin ( 19 | null, 20 | "Select an Image to perform OCR !", 21 | null, 22 | null, 23 | null, 24 | Xdp.OpenFileFlags.NONE, 25 | null, 26 | filechooser_callback 27 | ) ; 28 | } 29 | 30 | async void save_shot_scrot () { 31 | try { 32 | Process.spawn_command_line_sync ("scrot -s -o " + scrot_path) ; 33 | yield read_image (scrot_path) ; 34 | } catch (Error e) { 35 | print (e.message) ; 36 | } 37 | } 38 | 39 | void filechooser_callback (GLib.Object ? obj, GLib.AsyncResult res) { 40 | GLib.Variant info ; 41 | try { 42 | info = portal.open_file.end (res) ; 43 | Variant uris = info.lookup_value ("uris", VariantType.STRING_ARRAY) ; 44 | string[] files = uris as string[] ; 45 | string lead_file = "\'" + files[0].substring (7).replace ("%20", " ") + "\'" ; 46 | read_image.begin (lead_file, (obj, res) => { 47 | print ("Reading file from chooser") ; 48 | }) ; 49 | } catch (Error e) { 50 | critical (e.message) ; 51 | } 52 | } 53 | 54 | async void read_image (string file_path) { 55 | var lang_service = new LanguageService () ; 56 | string lang = lang_service.get_pref_language () ; 57 | label.label = "Reading Image" ; 58 | Idle.add (read_image.callback) ; 59 | yield ; 60 | try { 61 | string tess_command = "tesseract " + file_path + " " + out_path + @" -l $lang" ; 62 | Process.spawn_command_line_sync (tess_command, out res, out err, out stat) ; 63 | if (stat == 0) { 64 | copy_to_clipboard () ; 65 | } else { 66 | print ("Error is " + err + " status is " + stat.to_string ()) ; 67 | label.label = "Error Reading Image" ; 68 | } 69 | } catch (Error e) { 70 | critical (e.message) ; 71 | if (e.code == 8) { 72 | label.label = "Dependencies Not Found" ; 73 | } 74 | } 75 | } 76 | 77 | void copy_to_clipboard () { 78 | try { 79 | string text_output ; 80 | FileUtils.get_contents (out_path + ".txt", out text_output) ; 81 | if (text_output.length > 0) { 82 | clipboard.set_text (text_output, text_output.length) ; 83 | label.label = "Checkout Clipboard :)" ; 84 | } else { 85 | label.label = "Error Reading Image" ; 86 | } 87 | } catch (Error e) { 88 | print (e.message) ; 89 | } 90 | } 91 | 92 | public async void get_screenshot (Gtk.Label label_widget, string type) { 93 | string session = GLib.Environment.get_variable ("XDG_SESSION_TYPE") ; 94 | if (type == "file") { 95 | accept_files_fromchooser () ; 96 | } else if (type == "clip") { 97 | if (clipboard.wait_is_image_available ()) { 98 | clipboard.request_image (clipboard_callback) ; 99 | } else { 100 | print ("no image found in clipboard") ; 101 | label.label = "No Image found in Clipboard" ; 102 | } 103 | } else { 104 | if (session == "x11") { 105 | yield save_shot_scrot () ; 106 | } else { 107 | portal.take_screenshot.begin ( 108 | null, 109 | Xdp.ScreenshotFlags.INTERACTIVE, 110 | null, 111 | save_shot 112 | ) ; 113 | } 114 | } 115 | } 116 | 117 | void clipboard_callback (Gtk.Clipboard _, Gdk.Pixbuf pixbuf) { 118 | try { 119 | 120 | File file = File.new_for_path (Path.build_filename (scrot_path)) ; 121 | if (file.query_exists (null)) { 122 | file.delete (null) ; 123 | } 124 | DataOutputStream fos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION)) ; 125 | pixbuf.save_to_stream_async.begin (fos, "png", null, () => { 126 | read_image.begin (scrot_path, (obj, res) => { 127 | print ("Reading File") ; 128 | }) ; 129 | }) ; 130 | } catch (Error err) { 131 | critical (err.message) ; 132 | } 133 | } 134 | 135 | public void save_shot (GLib.Object ? obj, GLib.AsyncResult res) { 136 | string uri ; 137 | try { 138 | uri = portal.take_screenshot.end (res) ; 139 | string path = GLib.Filename.from_uri (uri, null) ; 140 | read_image.begin (path, (obj, res) => { 141 | print ("Taking Screenshot") ; 142 | }) ; 143 | } catch (Error e) { 144 | critical (e.message) ; 145 | } 146 | } 147 | 148 | public async bool start_tess_process (Gtk.Label label_widget, string type) { 149 | label = label_widget ; 150 | yield get_screenshot (label_widget, type) ; 151 | 152 | return true ; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /vid.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RajSolai/TextSnatcher/1d7e059e3639acf42db05f20e33ba75a6b9b8b23/vid.gif --------------------------------------------------------------------------------