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 ~/ 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

  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/

  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.


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

3 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/ 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 ~/ would actually be /home/anatoly/ 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.

  2. Matthias Braun says:

    Hi and thanks a lot for your instructions!

    I had to change the script a bit to work for me.

    I changed this:


    to this


    to avoid the error

    >No protocol specified

    I think the reason is that `ls /var/run/sddm/*` produces `/var/run/sddm/{some-id}`. If we concatenate that with `/var/run/sddm/` we get `/var/run/sddm//var/run/sddm/{some-id}` which doesn’t seem right.

    We could also remove the asterisk from `ls /var/run/sddm/*` to only get `{some-id}` which should also make the script work.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

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

%d bloggers like this: