Update worker.sh
This commit is contained in:
1 parent
78df9f0ce3
commit
266acb80cf
1 file changed
+17
-13
+17
-13
@@ -111,22 +111,26 @@ if [ "$TERMINAL" == "false" ] ; then
|
||||
# Get a list of open windows
|
||||
xwininfo -tree -root
|
||||
echo "==="
|
||||
xwininfo -tree -root | grep 0x | grep '": ("'
|
||||
xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//'
|
||||
|
||||
# xpra screenshot database/$INPUTBASENAME/screenshot # does not produce a screenshot; FIXME
|
||||
|
||||
# results in grey screenshot
|
||||
# screenshot is empty and has not been saved (maybe there are no windows or they are not currently shown)
|
||||
# import -window root database/$INPUTBASENAME/screenshot.jpg # ImageMagick
|
||||
|
||||
# results in grey screenshot, too
|
||||
sudo apt-get -y install scrot
|
||||
scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)"
|
||||
mv screenshot_* database/$INPUTBASENAME/
|
||||
# Count the windows on screen
|
||||
NUMBER_OF_WINDOWS=$(wc -l $(xwininfo -tree -root | grep 0x | grep '": ("' | sed -e 's/^[[:space:]]*//'))
|
||||
echo "NUMBER_OF_WINDOWS: $NUMBER_OF_WINDOWS"
|
||||
if [ NUMBER_OF_WINDOWS -lt 1 ] ; then
|
||||
echo "ERROR: Could not find a single window on screen :-("
|
||||
fi
|
||||
|
||||
# Works with Xvfb but cannot select window by ID
|
||||
# sudo apt-get -y install scrot
|
||||
# scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)"
|
||||
# mv screenshot_* database/$INPUTBASENAME/
|
||||
|
||||
# Works with Xvfb
|
||||
# sudo apt-get -y install x11-apps netpbm
|
||||
# xwd -root -silent -display :99.0 | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && cat database/$INPUTBASENAME/screenshot.jpg
|
||||
sudo apt-get -y install x11-apps netpbm xdotool
|
||||
xwd -id $(xdotool getactivewindow) -silent -display :0 | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!"
|
||||
|
||||
# We could simulate X11 keyboard/mouse input with xdotool here if needed
|
||||
|
||||
else
|
||||
echo "TODO: Make a screenshot of a terminal application"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user