How to capture a screenshot of the LightDM greeter screen

  1. If they are not already installed, install the packages x11-apps/xwd and media-gfx/imagemagick.

  2. Create the Bash script ~/lightdm-greeter-capture.sh containing the following:
    #!/bin/bash
    sleep 30
    DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root > /tmp/greeter.xwd
    convert /tmp/greeter.xwd /home/fitzcarraldo/greeter.png
    

    Make sure you make it executable:

    user $ chmod +x lightdm-greeter-capture.sh

  3. Log out of the Desktop Environment so that the LightDM greeter screen is displayed.

  4. Press Ctrl+Alt+F2 to switch to VT2.

  5. Log in to you user account and enter the following command (do not wait for it to complete):

    user $ sudo /home/fitzcarraldo/lightdm-greeter-capture.sh

  6. As soon as you have pressed Enter for the above command, press Ctrl+Alt+F7 to switch back to VT7.

  7. Wait for at least 30 seconds to be sure the Bash script has made a snapshot of the LightDM greeter screen, then log in.

  8. You should now find the file ~/greeter.png containing a snapshot of your LightDM greeter screen.

If you install media-libs/netpbm instead of (or as well as) media-gfx/imagemagick then you can use a different command to convert in the Bash script:

#!/bin/bash
sleep 30
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root | xwdtopnm | pnmtopng > /home/fitzcarraldo/greeter.png

The resulting PNG image looks equally good to my eyes.

About Fitzcarraldo
A Linux user with an interest in all things technical.

One Response to How to capture a screenshot of the LightDM greeter screen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.