Page 1 of 5 123 ... LastLast
Results 1 to 10 of 43

Thread: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

  1. #1
    Join Date
    Dec 2006
    Location
    Riga, Latvia
    Beans
    74
    Distro
    Ubuntu Karmic Koala (testing)

    Lightbulb HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    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'

    Code:
    sudo aptitude install xloadimage
    2) Create the script that will set the background immediately after entering your username/password:

    Code:
    sudo gedit /etc/gdm/PostLogin/Default
    Paste the following code in this file:

    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
    (P.S. If you have a tiled background, add the '-tile' switch to the line that executes 'xsetbg')

    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:

    Code:
    sudo chmod +x /etc/gdm/PostLogin/Default
    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 mv -v /etc/gdm/PreSession/Default /etc/gdm/PreSession/Default.bak
    There you go. Now while logging in you should be seeing your background color/wallpaper, instead of the gdm background color.

    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:

    Code:
    sudo rm /etc/gdm/PostLogin/Default
    sudo mv /etc/gdm/PreSession/Default.bak /etc/gdm/PreSession/Default
    The first line deletes the file that sets the background and the other line restores the original gdm script.
    Last edited by kirsis; July 21st, 2008 at 07:59 AM. Reason: Updated instructions

  2. #2
    Join Date
    Feb 2007
    Location
    India
    Beans
    291
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Quote Originally Posted by kirsis View Post
    Don't forget to make this script executable:

    Code:
    sudo chmod +x /etc/gdm/PreSession/Default
    Shouldn't this be the PostSession file?

  3. #3
    Join Date
    Dec 2006
    Location
    Riga, Latvia
    Beans
    74
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Damn, ADHD strikes again

    The PostLogin/Default file has to be executable, thanks for catching that

  4. #4
    Join Date
    Mar 2007
    Location
    Glasgow
    Beans
    306
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    I have been looking for something like this for ages.

    I even asked for something simliar to be intergrated into gutsy at the time.

    Thanks.

  5. #5
    Join Date
    Jun 2007
    Beans
    44

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Worked perfectly (after I resized my wallpaper to my resolution, as you suggested)!!! I have compiz enabled, and the graphical blinks/redraws are minimal (using a ATI Radeon 9200).

  6. #6
    Join Date
    Dec 2006
    Location
    Riga, Latvia
    Beans
    74
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Glad you like it, guys

    The compiz effect differs from PC to PC. For me the screen turns black for a few seconds, but for my buddy, who is also using this trick + compiz, the screen doesn't turn black at any point.

  7. #7
    Join Date
    Mar 2008
    Location
    Vimercate (MI), Italy
    Beans
    126
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    I'm running Hardy, and I already get this "effect" out of the box, by just setting the login background as my desktop background (speaking of colors)

    Instead, following your how-to just gives me a black screen until gnome is fully loaded

    Btw: I too noticed that compiz turns the background black, but it happens just sometimes
    2B OR (NOT 2B) That is the question. The answer is FF

  8. #8
    Join Date
    Dec 2006
    Location
    Riga, Latvia
    Beans
    74
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Setting the log in screen background to your desktop doesnt work as nicely for multiple users on one computer. This way every user sees his/her wallpaper + you dont have to think about matching gdm themes/backgrounds

    It's odd that you got a persistent black screen. Is your desktop background color set to black (if its not using a wallpaper)? It appears to me that xsetbg fails to find your wallpaper and instead sets your desktop to the primary background color.

    If your background color is not black, then it must be some external effect, because AFAIK if xsetbg failed, you should be seeing what you always saw before it.


    At any rate, you can revert to your previous configuration with:

    Code:
    sudo rm /etc/gdm/PostLogin/Default
    sudo mv /etc/gdm/PreSession/Default.bak /etc/gdm/PreSession/Default

  9. #9
    Join Date
    Mar 2007
    Beans
    Hidden!

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Why is this nasty hack needed when in feisty the wallpaper worked right?

  10. #10
    Join Date
    Jun 2006
    Location
    Trivandrum India
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: (GDM) Show the user wallpaper/background color, while logging in

    Worked for me like a dream
    Ubuntu Rocks!!!

Page 1 of 5 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •