This script handles global print screen keystrokes for you to fully enjoy Lightshot screenshot tool (home page) on any Linux/Unix.
It is a standard POSIX (wiki) shell script, it should work in any Linux (wiki) or more generally any Unix (wiki) distribution (more precisely, your shell (wiki)).
- It does not download Lightshot for you.
- It does not install Lightshot for you.
- It does not launch Lightshot for you!
This script's sole purpose is to simulate/send hotkey to Lightshot, be it Print, Control + Print, or anything else completely.
-
One necessary command-line tool to have manually installed (same package name):
xdotool
(Ubuntu man page): In Ubuntu the package is in the universe part of the official archive.
-
One more necessary package which should be pre-installed on most distributions (wiki):
procps
containingpgrep
(man page): In Ubuntu the package is in the main part of the official archive.
-
X Window System (wiki), with any desktop environment (wiki).
-
Lightshot (installation info page) properly installed into Wine (home page).
Visit the latest release download page (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:
chmod 755 lightshot_print_screen
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.
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:
Keyboard → Shortcuts → Custom Shortcuts → click on button named Add custom shortcut and fill the form out.
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.
There is also the help switch (not --help
):
./lightshot-print-screen -h
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:
Project: Lightshot print screen Linux handler
Version: 8.0 (2024-Jun-20)
GitHub : https://burian.work/lightshot
--------------------------------------------------------------------
Description: This script works with XDOTOOL to trigger Print Screen
key combination in Lightshot application installed on Linux in Wine.
The script, however, won't launch Lightshot for you due to variable
installation locations which make it impossible. You need to run it!
License is MIT. The code can be further enhanced by others provided
that any new copies have my copyright notice included in every case.
--------------------------------------------------------------------
Usage in terminal: ./lightshot_print_screen [-k HotKey]
-k HotKey: Optional switch requiring one argument,
which is the print screen hotkey combination.
For the left Control key and the Print Screen key
that would be -k Control_L+Print (as an example).
-h: Show this help.
Usage in desktop environment:
You need to find Keyboard shortcuts, and re-map Print to run
this script, an example from Linux Mint is placed on GitHub.
Author: Copyright 2018-2024 Vlastimil Burián, [email protected]
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.
Please open a new issue ticket (direct link) or you can also mail me at [email protected] (email link).