|
| 1 | +[](https://github.com/burianvlastimil/lightshot-print-screen-linux-handler/releases/latest) [](https://github.com/burianvlastimil/lightshot-print-screen-linux-handler/?tab=MIT-1-ov-file) |
| 2 | + |
| 3 | +*** |
| 4 | + |
| 5 | +# Lightshot print screen Linux handler |
| 6 | + |
| 7 | +This script handles global print screen keystrokes for you to fully enjoy [Lightshot screenshot tool](https://app.prntscr.com/en/) (home page) on any Linux/Unix. |
| 8 | + |
| 9 | +It is a standard [POSIX](https://en.wikipedia.org/wiki/POSIX) (wiki) shell script, it should work in any [Linux](https://en.wikipedia.org/wiki/Linux) (wiki) or more generally any [Unix](https://en.wikipedia.org/wiki/Unix) (wiki) distribution (more precisely, your [shell](https://en.wikipedia.org/wiki/Unix_shell) (wiki)). |
| 10 | + |
| 11 | +## What the script does NOT |
| 12 | + |
| 13 | +- It does not download Lightshot for you. |
| 14 | +- It does not install Lightshot for you. |
| 15 | +- It does not launch Lightshot for you! |
| 16 | + |
| 17 | +## What the script actually does |
| 18 | + |
| 19 | +This script's sole purpose is to simulate/send hotkey to Lightshot, be it Print, Control + Print, or anything else completely. |
| 20 | + |
| 21 | +*** |
| 22 | + |
| 23 | +## Requirements |
| 24 | + |
| 25 | +- One necessary command-line tool to have manually installed (same package name): |
| 26 | + - [`xdotool`](https://manpages.ubuntu.com/manpages/jammy/man1/xdotool.1.html) (Ubuntu man page): In Ubuntu the package is in the _universe_ part of the official archive. |
| 27 | + |
| 28 | +- One more necessary package which should be pre-installed on most [distributions](https://en.wikipedia.org/wiki/Linux_distribution) (wiki): |
| 29 | + - `procps` containing [`pgrep`](https://linux.die.net/man/1/pgrep) (man page): In Ubuntu the package is in the _main_ part of the official archive. |
| 30 | + |
| 31 | +- [X Window System](https://en.wikipedia.org/wiki/X_Window_System) (wiki), with any [desktop environment](https://en.wikipedia.org/wiki/Desktop_environment) (wiki). |
| 32 | + |
| 33 | +- [Lightshot](https://app.prntscr.com/en/wine-lightshot.html) (installation info page) properly installed into [Wine](https://www.winehq.org/) (home page). |
| 34 | + |
| 35 | +*** |
| 36 | + |
| 37 | +## Usage instructions |
| 38 | + |
| 39 | +### Download and Preparation |
| 40 | + |
| 41 | +Visit the [latest release download page](https://github.com/burianvlastimil/lightshot-print-screen-linux-handler/releases/latest) (direct link). If you download the file `lightshot-print-screen`, you will need to open your terminal and give it **permission to read and execute** to all users with: |
| 42 | + |
| 43 | +``` |
| 44 | +chmod 755 lightshot-print-screen |
| 45 | +``` |
| 46 | + |
| 47 | +Note, that you will be able to avoid this step of changing permissions if you download the source code or clone the repository. However, I advise you to download that single file directly as you will not have to remove anything afterward. |
| 48 | + |
| 49 | +### General |
| 50 | + |
| 51 | +Now you need to place it somewhere, e.g. to your home directory inside `~/bin`, and put a path to it e.g. in Linux Mint Cinnamon to the: |
| 52 | + |
| 53 | +**Keyboard** → **Shortcuts** → **Custom Shortcuts** → click on button named **Add custom shortcut** and fill the form out. |
| 54 | + |
| 55 | +### Command-line interface |
| 56 | + |
| 57 | +Let me just point out, that there are many error checks along the whole script, so I advise you to run it within your terminal while your Lightshot is running to possibly debug any and all misbehaviors. |
| 58 | + |
| 59 | +There is also the help switch (not `--help`): |
| 60 | + |
| 61 | +``` |
| 62 | +./lightshot-print-screen -h |
| 63 | +``` |
| 64 | + |
| 65 | +which will point out the possibility for you to feed the key combination you have configured in your Lightshot interface without ever editing the script: |
| 66 | + |
| 67 | +``` |
| 68 | +Project: Lightshot print screen Linux handler |
| 69 | +Version: 9.0 (2025-Apr-21) |
| 70 | +GitHub : https://burian.work/lightshot |
| 71 | +-------------------------------------------------------------------- |
| 72 | +Description: This script works with XDOTOOL to trigger Print Screen |
| 73 | +key combination in Lightshot application installed on Linux in Wine. |
| 74 | +The script, however, won't launch Lightshot for you due to variable |
| 75 | +installation locations which make it impossible. You need to run it! |
| 76 | +License is MIT. The code can be further enhanced by others provided |
| 77 | +that any new copies have my copyright notice included in every case. |
| 78 | +-------------------------------------------------------------------- |
| 79 | +Usage in terminal: ./lightshot-print-screen [-k HotKey] |
| 80 | +
|
| 81 | + -k HotKey: Optional switch requiring one argument, |
| 82 | + which is the print screen hotkey combination. |
| 83 | + For the left Control key and the Print Screen key |
| 84 | + that would be -k Control_L+Print (as an example). |
| 85 | +
|
| 86 | + -h: Show this help. |
| 87 | +
|
| 88 | +Usage in desktop environment: |
| 89 | +
|
| 90 | + You need to find Keyboard shortcuts, and re-map Print to run |
| 91 | + this script, an example from Linux Mint is placed on GitHub. |
| 92 | +
|
| 93 | +Author: |
| 94 | + Copyright 2018-2025 |
| 95 | + Vlastimil Burián |
| 96 | + info@vlastimilburian.cz |
| 97 | +``` |
| 98 | + |
| 99 | +### Graphical interface |
| 100 | + |
| 101 | +There is none. This script however launches the Lightshot screenshot tool directly, same as if you right-clicked on its tray icon and then clicked _Take a screenshot_. |
| 102 | + |
| 103 | +*** |
| 104 | + |
| 105 | +## Screenshot from Linux Mint Cinnamon keyboard settings |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +*** |
| 110 | + |
| 111 | +## Reporting bugs and suggestions |
| 112 | + |
| 113 | +Please open a [new issue ticket](https://github.com/burianvlastimil/lightshot-print-screen-linux-handler/issues/new) (direct link). |
0 commit comments