This blog post explains how to try the GDM login screen and make screen shots in any, user-specified screen resolution. This can be useful when designing GDM themes. The instructions were tried on Ubuntu Hardy (8.04), but they should work on Ubuntu Intrepid (8.10) and Ubuntu Jaunty (9.04). They won't work on Ubuntu Karmic or Ubuntu Lucid, because they contain GDM 2, which doesn't have the --xnest
feature implemented (** (gdmflexiserver:18758): WARNING **: Not yet implemented
).
Installation instructions:
- (When asked to run a command, run it in a terminal window.)
- Make sure GDM is your display manager. Since GDM is the default, chances are that it is. To make sure, run sudo dpkg-reconfigure gdm, and select GDM if it asks you.
- Log in using GDM if you haven't already done so. To do that, run sudo /etc/init.d/gdm restart . (You will lose your X11 session doing so.)
- Install Xephyr, a modern nested (embedded) X server, similar to Xnest: sudo apt-get install xserver-xephyr
- Install ImageMagick for making screen shots in various image file formats: sudo apt-get install imagemagick
- Try Xephyr: Xephyr :9 -screen 800x600 -extension RANDR . A new window should appear with the usual a black-and-white diagonal background and a diagonal cross-shaped cursor. Abort Xephyr in the terminal window. Try with different -screen sizes.
- Find your GDM Xnest command line by running grep ^Xnest= /etc/gdm/gdm.conf . You should see something like Xnest=/usr/share/gdm/gdmXnestWrapper -br -audit 0.
- Create a new xnest wrapper script:
echo '#!/bin/sh GEOMETRY="`cat /tmp/new-xnest-geometry`" GEOMETRY="${GEOMETRY:-800x600}" exec Xephyr "$@" -screen "$GEOMETRY" -extension RANDR' | sudo tee /usr/local/sbin/gdm-xnest && chmod 755 /usr/local/sbin/gdm-xnest
- Create the screenshot helper script:
echo '#! /bin/bash -- # by pts@fazekas.hu at Sat Feb 20 11:09:20 CET 2010 GOT=($(ps x | perl -ne '\''if (/[ ]Xephyr :/) { $c++; print"$1 $2\n" if (/[ ]Xephyr :(\d+)(?= ).* -auth (\S+)/)} END{die"Xephyr not found\n"if!$c;die"multiple Xephyrs found\n"if$c>1}'\'')) test "$?" = 0 || exit "$?" if test ${#GOT} != 2; then echo "Xephyr detection failed" >&2 exit 90 fi export DISPLAY=":${GOT[0]}" XAUTHORITY="${GOT[1]}" exec import -window root "$@"' | sudo tee -a /usr/local/bin/xephyr-import && sudo chmod 755 /usr/local/bin/xephyr-import
- Change the Xrandr= setting in /etc/gdm/gdm.conf to use the new wrapper script: sudo perl -pi -0777 -e 's@^Xnest=.*@Xnest=/usr/local/sbin/gdm-xnest -br -audit 0@gm' /etc/gdm/gdm.conf
- Make sure the Xrandr= setting is changed: check that running grep ^Xnest= /etc/gdm/gdm.conf displays Xnest=/usr/local/sbin/gdm-xnest -br -audit 0
- Save your work in your X11 session, and restart GDM: sudo /etc/init.d/gdm restart . (You will lose your X11 session doing so.)
- If not already logged in, login in at the GDM login screen.
- Run gdmflexiserver --xnest to get the GDM login dialog inside a window of your regular session. You can specify the window size using e.g. echo 1024x768 >/tmp/new-xnest-geometry && gdmflexiserver --xnest
- To make a JPEG screen shot, run xephyr-import -quality 75 screenshot.jpg while the Xephyr window with the GDM login screen is still open.
- To make a PNG screen shot, run xephyr-import screenshot.png .