EDIT: An improved, multi-user friendly version available on page 3. Clickity:
http://ubuntuforums.org/showthread.p...33#post5427233
-----------------------------------
One of my pet peeves with GDM has been that after logging in, it always turns the screen to a certain color (default = light brown, though this can be changed).
I feel that showing the users wallpaper or the users background color, while starting up the session, feels more polished. Here's how to achieve it, if you feel the same way:
1) We need the install the package xloadimage, which contains the app 'xsetbg'
2) Create the script that will set the background immediately after entering your username/password:Code:sudo aptitude install xloadimage
Paste the following code in this file:Code:sudo gedit /etc/gdm/PostLogin/Default
(P.S. If you have a tiled background, add the '-tile' switch to the line that executes 'xsetbg')Code:#!/bin/sh # # Note that output goes into the .xsession-errors file for easy debugging # # Extract the wallpaper filename WALLPAPER="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N s/^[ \t]*<entry name="picture_filename".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`" # Check if the wallpaper file exists. If yes - draw it, if no - use primary background color if [ -e "$WALLPAPER" ] && [ -f "$WALLPAPER" ] ; then xsetbg -onroot "$WALLPAPER" else PRIMARY_COLOR="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N s/^[ \t]*<entry name="primary_color".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`" xsetroot -cursor_name left_ptr -solid "$PRIMARY_COLOR" fi exit 0
This script will check for a wallpaper setting, and use 'xsetbg' to draw it to the root window. If a wallpaper image does not exist, it will fill the screen with the desktop background color.
Don't forget to make this script executable:
Now the only step left is to remove the /etc/gdm/PreSession/Default file. This is the file that sets the root window color and it executes after the PostLogin file, so just move it out of the way:Code:sudo chmod +x /etc/gdm/PostLogin/Default
There you go. Now while logging in you should be seeing your background color/wallpaper, instead of the gdm background color.Code:sudo mv -v /etc/gdm/PreSession/Default /etc/gdm/PreSession/Default.bak
Problems
There are three problems that this script doesn't or can't handle.
1) If you use a gradient as your desktop background, it will not be displayed. The screen will be filled with just one color (the primary color in the gradient)
2) If your wallpaper is scaled to fit, I suggest you resize it so that it matches your desktop as this script will not do that for you. You can, in theory, use the '-background' switch, coupled with '-border black', '-smooth' and (for png's) '-gamma 2.0', but I've found that 'xsetbg' can't properly scale to fit a lot of images (depending on their resolution, it may leave empty vertical/horizontal space at the edges) and the quality of scaled images is sub-par. I suggest you just resize the wallpaper to fit your resolution in GIMP.
3) If you use desktop effects then at one point the desktop might turn black. I haven't figured out yet, how to avoid this.
There you go, I hope this is useful for somebody
(Tested on Hardy Heron, but should work on older versions too.)
Update: Instructions on how to reverse the modifications
If for some reason the script isn't working out for you (due to the black screen problem or for whatever other reason), you can revert the effect with:
The first line deletes the file that sets the background and the other line restores the original gdm script.Code:sudo rm /etc/gdm/PostLogin/Default sudo mv /etc/gdm/PreSession/Default.bak /etc/gdm/PreSession/Default



Adv Reply





Bookmarks