Skip to content

burianvlastimil/lightshot-print-screen-linux-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Download the latest version         Donate via PayPal         GPLv3 License         ShellCheck Passing


Lightshot print screen Unix handler

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)).

What the script does NOT

  • It does not download Lightshot for you.
  • It does not install Lightshot for you.
  • It does not launch Lightshot for you! This is very important.

What the script actually does

This script's sole purpose is to simulate (send) hotkey to Lightshot, be it Print, Control + Print, or anything else completely.


Requirements

  • 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 containing pgrep (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).


Usage instructions

Download and Preparation

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.

General

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 20 Cinnamon to the:

KeyboardShortcutsCustom Shortcuts → click on button named Add custom shortcut and fill the form out.

Command-line interface

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:

Script  : Lightshot print screen Unix handler
Version : 7.0 (stable)
GitHub  : https://git.io/fx2US
--------------------------------------------------------------------
Description: This script works with XDOTOOL to trigger Print Screen
key combination in Lightshot application installed on Unix in Wine.
License: GPL 3.0. The code itself can be further enhanced by others.
The script, however, won't launch Lightshot for you due to variable
installation locations which make it impossible. You need to run it!
--------------------------------------------------------------------
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 '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.

Graphical interface

There is none. This script however launches the Lightshot screenshot tool directly.


Screenshot from Linux Mint 20 Cinnamon

Screenshot from Linux Mint 20


Reporting bugs and suggestions

Please open a new issue ticket (direct link) or you can also mail me at info@vlastimilburian.cz (email link).


Donations

Donate via PayPal

Donations are possible via my PayPal account issued on the same email address as mentioned above.