This quick tutorial is going to show you how to capture LightDM Unity Greeter, the log in screen, in Ubuntu with Unity Desktop Environment.
Besides installing Ubuntu as a guest OS via Virtualbox or VMware Player, there’s no graphical screenshot tool to capture the log-in screen.
However, you can use the LightDM test mode to preview your login screen and take a screenshot:
METHOD 1: (Thanks to Vladimir)
1. Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to install required package:
sudo apt-get install xserver-xephyr
2. If you’ve changed Unity Greeter appearances: remove the white dots or set login background different to user’s desktop wallpaper, switch to user lightdm by running below commands one by one:
sudo -i xhost +SI:localuser:lightdm su lightdm -s /bin/bash
3. Run below command to preview your Login screen and take a screenshot:
lightdm --test-mode
Method 2: Capture Login Screen via a simple script:
1. Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to create the script:
echo 'sleep 30; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root' > /tmp/shot.sh
This will create a script shot.sh under /tmp/ directory. It will capture your display with 30 seconds delay.
2. Now switch to command console by pressing Ctrl+Alt+F2, log in with your username and password.
3. When you’re in, run the script via:
sudo bash /tmp/shot.sh >/tmp/shot.xwd
4. Press Ctrl+Alt+F7 to switch back to graphical session and log out by normal way. While you can see login screen, wait for some seconds.
5. Login by normal way. And install imagemagick and convert your screenshot:
sudo apt-get install imagemagick convert /tmp/shot.xwd loginscreen.png
Finally open “loginscreen.png” with your favorite image viewer and see the magic!
Why write scripts when there is a simple solution for picture windows logon screen?
sudo apt-get install xserver-xephyr
lightdm – test-mode
Thanks for you tip. But you need to first switch to user lightdm in terminal if you’ve changed the LightDM appearances.
You can try this:
gnome-screenshot -d 10
you don’t need to install any thing just enter the command and lock the screen, the screen will be shot within 10 seconds after the command is executed.