gdm login screen: how to output current IP address

11:52 pm gnome

I could not find a way to put some text (for example, current IP address) into background of the gdm login screen. ImageMagic to the rescue:

cd /usr/share/gdm/themes/MyTheme
convert -draw \
  "text 10,50 \"`ifconfig wlan1 | awk '/inet addr/{ print $2 }'`\"" \
  background.jpg background.hacked.jpg

Put that line into some startup script (for example, /etc/gdm/Init/Default). Then, change your theme xml (/usr/share/gdm/themes/MyTheme/mytheme.xml) to refer to background.hacked.jpg (instead of background.jpg). Voila.

2 Responses

  1. Seppo Yli-Olli Says:

    Just a wild guess: there’s no builtin way to do that because “current IP address” isn’t an easily defined concept. You might be connected to several interfaces which might all have one or more working current IP addresses. ^^
    (As for putting arbitrary other text there, good job :)

  2. Sergey Udaltsov Says:

    Seppo: well, for some particular machine you usually know the interfaces/addresses you’re interested in. But in general – yes, you’re right. Anyway, this is just a sample, people can customize it as they like…