Results 1 to 1 of 1

Thread: PrtScr and Alt-PrtScr for Lubuntu/LXQt 19.04 and 19.10

  1. #1
    Join Date
    Jun 2019
    Lubuntu 19.10 Eoan Ermine

    PrtScr and Alt-PrtScr for Lubuntu/LXQt 19.04 and 19.10

    The keyboard shortcuts PrtScr (copy full screen to clipboard) and Alt-PrtScr (copy active window to clipboard) are not available in Ubuntu, although they are extremely useful.

    Here's a recipe for settling them up.

    First, install "scrot" and "xclip" (it's very likely that they are already installed).

    Second, create two executable scripts in /usr/local/bin with 755 permissions:
    1: containing the line scrot -o /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f'
    2: containing the line scrot -o -u /tmp/clip_$(id -u) -e 'xclip -selection clipboard -t image/png < $f'

    Open Preferences -> LXQt Settings -> Shortcut Keys from the Start Menu. !!This part is GUI dependent, please adjust for your own environment!!

    Check if PrtScr ("Print") and Alt-PrtScr ("Print Window") are already present (they probably aren't).

    Add this command to the PrtScr shortcut key: sh /usr/local/bin/

    Do the same for Alt-PrtScr using: sh /usr/local/bin/

    Now you can paste your latest screenshot into any graphics or LibreOffice program. It works exactly as a normal Copy and Paste, but with screenshots.

    The scripts will create the files /tmp/clip_"UID" (eg, clip_1001) when running, these will disappear after restart and will be overwritten with each screenshot.

    1: the reason for including UUID in the filename instead of just naming it "clip" is due to file ownership/permissions. When changing user, the "clip" file still exists and cannot be overwritten by the new user, as it's owned by the previous user. Fiddling with access rights might be a better solution, I don't know. This one's fireproof.
    2: using an executable script (instead of just assigning the full command to the shortcut key) is due to the fact that the shortcut key function is not able to expand a command, in this case $(id-u).
    3: in LXQt the shortcut keys are user-specific. The key assignments are stored in ~/.config/lxqt/globalkeyshortcuts.conf
    Last edited by ml9104; 3 Weeks Ago at 10:28 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts