Skip to content

This script handles global Print Screen key strokes for you to fully enjoy Lightshot screenshot tool on Linux/Unix.

License

Notifications You must be signed in to change notification settings

burianvlastimil/lightshot-print-screen-linux-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Download the latest version         MIT License


Lightshot print screen Linux 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!

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 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:

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]

Graphical interface

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.


Screenshot from Linux Mint Cinnamon keyboard settings

Screenshot from Linux Mint Cinnamon keyboard settings


Reporting bugs and suggestions

Please open a new issue ticket (direct link) or you can also mail me at [email protected] (email link).