I LOVE imagemagick, but sometimes it goes way beyond my simple CLI and scripting knowledge with its bizarro obtuseness.
Got fed up of the inconsistencies in freaking linux just to get a simple feckin’ sceenshot!
On my main desktop - its main keyboard (and mouse) is Synergy KVM client, with the server running on MacOS ( this is not ideal - would prefer vice versa, but the server runs on my Work MacBook and the Synergy client on it HATES something about it - it’s the big brother nazi overlord software I reckon - 'cause it doesn’t happen on my personal Mac [I may yet make that the Synergy server]) - so anyway - despite using a Lenovo Thinkpad Keyboard II (bluetooth with trackPOINT ) with an actual PRT-SCRN button - it doesn’t translate over to Linux…
So I have to fire up the builtin screenshotting tool (it’s VERY cumbersome) just to take a screenshot.
Works a treat “out of the box” on Pop!OS on the actual ThinkPad with the PRT-SCRN button (between Alt and Ctrl on the right).
On the Pi? No dice EITHER way - there’s a screenshotting tool (the same gnome one on x86) but it NEVER EVER launches an interface. So I figured out (from yonks ago) I can use “import” which is part of ImageMagick to grab my desktop :
sudo apt install imagemagick
(Pop!OS is a bit remiss here - Ubuntu nearly always just installs imagemagick anyway)
import -window root output.PNG
So I figure - I’m gonna plonk that into a shell script :
#!/usr/bin/env bash
# We need imagemagick install for this qunt to work:
# screenshitter program is "import"
NOMNOM=$(uname -n)
NOMNOM=$NOMNOM-$(date '+%Y%m%d-%H%M')
# NOMNOM-STR=$(uname -n)
# import -window root shictunt00.png
echo ScreenShit-$NOMNOM.png
OUTIE=~/ResilioSync/bigshit/Photos/Screenshots/
import -window root $OUTIE$NOMNOM
That’s nearly EXACTLY what I wrote earlier, interactively, in my shell… But would that work? NO!
On the Thinkpad (Pop 22) :
╭─x@fenriz ~/Videos
╰─➤ ~/bin/screenio-qunto.bash
ScreenShit-fenriz-20230308-1634.png
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/421.
Desktop (Pop 22) :
╭─x@titan ~/bin ‹main*›
╰─➤ ./screenio-qunto.bash 1 ↵
ScreenShit-titan-20230308-1645.png
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/421.
Pi4 (Pop 22) :
╭─x@bebhionn ~/bin ‹main*›
╰─➤ ./screenio-qunto.bash
ScreenShit-bebhionn-20230308-1646.png
import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/421.
But :
╭─x@bebhionn ~/bin ‹main*›
╰─➤ import -window root eatmyass.png
╭─x@bebhionn ~/bin ‹main*›
╰─➤ ls -al eatmyass.png
-rw-rw-r-- 1 x x 1407729 Mar 8 16:48 eatmyass.png
works perfectly (on all of the above too) and creates a screenshot! What’s going on?
What’s that security bullshit? I remember recently having to tweak some bizarro XML or JSON file to get imagemagick to write a PDF - but WHY??? If there’s security risks there - why not have one branch of imagemagick to use on servers (e.g. Apache) and another that less of a Nazi piece of crap for desktop users? All this because I’m trying to batch something? Interactive’s more secure?
Update : doesn’t like me outputting to a folder that just happens to also be a sync folder from ResilioSync - but far as Linux is concerned - that folder is JUST A FOLDER on my $HOME!!!
IPSO FACTO : IT’S JUST AN EFFING FOLDER with POSIX stuff