How to capture a screenshot of the SDDM greeter screen

In my previous post I explained how to capture a screenshot of the LightDM greeter screen. The procedure is essentially the same for the SDDM greeter screen; only the Bash script differs slightly. The procedure is given below.

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

  2. Create the Bash script ~/sddm-greeter-capture.sh containing the following:
    TMPXAUTHORITY=$(ls /var/run/sddm/*)
    sleep 30
    DISPLAY=:0 XAUTHORITY=/var/run/sddm/$TMPXAUTHORITY xwd -root > /tmp/greeter.xwd
    convert /tmp/greeter.xwd /home/fitzcarraldo/greeter.png
    

    Make sure you make it executable:

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

  3. Log out of the Desktop Environment so that the SDDM 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/sddm-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 SDDM greeter screen, then log in.

  8. You should now find the file ~/greeter.png containing a snapshot of your SDDM 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:

TMPXAUTHORITY=$(ls /var/run/sddm/*)
sleep 30
#DISPLAY=:0 XAUTHORITY=/var/run/sddm/$TMPXAUTHORITY xwd -root | xwdtopnm | pnmtopng > /home/fitzcarraldo/greeter.png

The resulting PNG image looks equally good to my eyes.

Advertisements

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

2 Responses to How to capture a screenshot of the SDDM greeter screen

  1. Anatoly says:

    One question… All clear except one What user is? And what is the ~ path? Where to write this script? Understandable…

    • Fitzcarraldo says:

      The user is you. Your username. For example, if your user account name is anatoly, the path would be /home/anatoly/sddm-greeter-capture.sh and the owner of the script would be anatoly. The tilde symbol (~) is the standard Unix/Linux symbol for your home directory and saves you from having to type the entire path to your home directory. For example, if your username is anatoly then ~/sddm-greeter-capture.sh would actually be /home/anatoly/sddm-greeter-capture.sh. The ‘user $‘ prompt in cyan in the blog post is just to show the reader that the command is entered in the normal user’s session, not in the root user’s session. For example, the user prompt on a machine I’m using at the moment is actually ‘fitzcarraldo@sabayon ~ $‘. That is what the prompt ‘user $‘ represents in the blog post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: