Programmatic x11 screenshot for debugging

#1

Ive got basically a fork of https://github.com/balena-io-playground/x11-window-manager that does chromium window (with systemd for input)

Im trying to nab a screenshot off site to be able to debug.

Ive built up either of these two one liner, but i always get a 1024x600 black border with white inside

XAUTHORITY="$(ls /tmp/serverauth.*)" xwd -root -display :0 | convert xwd:- shot.png
or
DISPLAY=:0 XAUTHORITY="$(ls /tmp/serverauth.*)" import -window root shot.png

Im probably screwing up the display or something. I hacked the XAUTHORITY in as well as without it I get “No protocol specified”

Thoughts?

Heres some debug

  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 /sbin/init quiet systemd.show_status=0
   15 ?        S      0:00 sleep infinity
   26 ?        Ss     0:00 /lib/systemd/systemd-journald
   33 ?        Ss     0:00 /lib/systemd/systemd-udevd
   66 ?        Ssl    0:00 /lib/systemd/systemd-timesyncd
   85 ?        Ss     0:00 bash /usr/src/app/start.sh
   87 ?        Ss     0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
  124 ?        S      0:00 su -c startx /home/chromium/xstart.sh chromium
  125 ?        Ss     0:00 /bin/sh /usr/bin/startx /home/chromium/xstart.sh
  145 ?        S      0:00 xinit /home/chromium/xstart.sh -- /etc/X11/xinit/xserverrc :0 -auth /tmp/serverauth.fRx5HNjMLb
  146 tty2     Ssl+   0:00 /usr/lib/xorg/Xorg -s 0 dpms -nocursor -nolisten tcp :0 -auth /tmp/serverauth.fRx5HNjMLb
  155 ?        S      0:00 /bin/bash /home/chromium/xstart.sh
  156 ?        Sl     0:04 /usr/lib/chromium-browser/chromium-browser-v7 --enable-pinch --kiosk --app=https://xxxxx
  167 ?        S      0:00 /usr/lib/chromium-browser/chromium-browser-v7 --type=zygote --noerrdialogs
  169 ?        S      0:00 /usr/lib/chromium-browser/chromium-browser-v7 --type=zygote --noerrdialogs
  194 ?        Sl     0:01 /usr/lib/chromium-browser/chromium-browser-v7 --type=gpu-process --field-trial-handle=xxxxx
  391 ?        Sl     0:00 /usr/lib/chromium-browser/chromium-browser-v7 --type=renderer --use-fake-ui-for-media-stream --field-trial-handle=xxxxx
  622 pts/1    Ss     0:00 /bin/bash
 2320 pts/1    R+     0:00 ps ax



xwininfo: Window id: 0x25d (the root window) (has no name)

  Root window id: 0x25d (the root window) (has no name)
  Parent window id: 0x0 (none)
     6 children:
     0x400001 "Kiosk App": ("lb-offerer-dev.netlify.com" "Chromium-browser")  1004x580+10+10  +10+10
     0x400005 (has no name): ()  1x1+0+0  +0+0
     0x80000b (has no name): ()  1x1+0+0  +0+0
     0xa00001 (has no name): ()  1x1+0+0  +0+0
     0x600003 "chromium-browser-v7": ("chromium-browser-v7" "Chromium-browser-v7")  200x200+0+0  +0+0
        1 child:
        0x600004 (has no name): ()  1x1+-1+-1  +-1+-1
     0x600001 "chromium-browser-v7": ("chromium-browser-v7" "Chromium-browser-v7")  10x10+10+10  +10+10
#8

Hey @jacobrosenthal I think the most helpful starting point would be to retrieve the .xwd file and open it in something like gimp. Then we can isolate the problem.

I’ve seen convert behave weirdly with different image depths, so let’s rule that out.