# Use your screensaver as your login screen background

## ecatmur

There's lots of beautiful screensavers in Portage, the best perhaps being skyrocket and the rss-glx collection.

But what's the point of having all this eyecandy if you hardly ever get to see it? Wouldn't it be better to have it waiting for you when you come to log in via GDM? Well, now you can!

Screenshot (afraid that's not a very good one - it's a bit hit-and-miss as PrintScreen doesn't work in gdm, so I had to set xwd on a timer then Ctrl-Alt-F7 back to the login screen)

OK, first thing is to set up gdm (I use 2.5.90.1, but it looks like 2.4.1.7 should work). As root, launch gdmsetup and set local login to standard greeter with no background. Then open xscreensaver-demo, find your favourite screensaver, hit Settings, Advanced, and note down the command line. Convert the program to a full path - if it isn't in your path, it's probably in /usr/lib/xscreensaver.

Then, edit /etc/X11/gdm/gdm.conf, find the BackgroundProgram line and set it to something like:

```
BackgroundProgram=/usr/lib/xscreensaver/skyrocket --root

```

Now restart gdm (/etc/init.d/xdm restart) and watch the screensaver paint the root window behind the login box! What other OS can do that?  :Razz: 

Problems

If it doesn't work, it's probably because the permisions on your hardware accelerated video driver nodes are too restrictive. Note that the background program will run as gdm, not as root, so if you're using an nvidia card with the binary drivers you need to make sure that gdm can write to /dev/nvidia0 and /dev/nvidiactl. I acheive this by making gdm a member of the video group and making /dev/nvidia* owned by root:video, permissions 660 in /etc/devfs.d/nvidia.conf:

```
LOOKUP          ^nvidia           MODLOAD nvidia

REGISTER        ^nvidia           PERMISSIONS root.video 660
```

and also making sure both columns are 0660 for the <dri> alias in /etc/security/console.perms:

```
<xconsole> 0660 <dri>        0660 root.video
```

Last edited by ecatmur on Thu Mar 11, 2004 9:45 am; edited 3 times in total

----------

## snakattak3

Thats really cool, gonna have to try that when I get home tonight. You think it would work with KDM as well?

----------

## RedDawn

Does this work with kde....

I Like it but not enought to use the Gnome gdm crap thingi..

i dont like Gnome...   

So does this work on KDM..     :Razz:      (kde 3.2 )

----------

## sigix

 :Smile: 

aah nice!

worked with gnome, not tried with kdm

----------

## deadaim

Does this work with xdm?

----------

## drakos7

Nice work. Now I am greeted with the BSOD: Blue Screen of the Day.   :Wink: 

----------

## christsong84

 *drakos7 wrote:*   

> Nice work. Now I am greeted with the BSOD: Blue Screen of the Day.  

 

ahh...good 'ol memories from back in the day when running NT...*lost in memories*  :Wink: 

----------

## Bastux

I'm very impressed!   :Cool:   :Cool:   :Cool:   :Cool: 

Very very very good idea!

----------

## mahir

i dont have a gfd.conf

i have a gdm.conf

and there is no background line?

what do i do?

----------

## ecatmur

Thanks for pointing that out; corrected.

Not sure about the missing line: you could try putting it in or if that doesn't work you may need to upgrade gdm.

----------

## NitroPye

I think it should also be "-root" instead of "--root". I don't know though, because I cannot get it to work. I created the file /etc/devfs.d/nvidia.conf and added to it [code]/dev/nvidia* root:video 600[code] and I get an error on boot.

----------

## TimG

 *NitroPye wrote:*   

> I created the file /etc/devfs.d/nvidia.conf and added to it 
> 
> ```
> /dev/nvidia* root:video 600
> ```
> ...

 

I did the same thing.  It caused devfs to error out on boot and left me with / mounted read-only and no useful devices.  I ended up booting off cd to fix it.

I looked in the devfsd.conf and it appears the line in nvidia.conf should look like this:

```
REGISTER       nvidia.*       PERMISSIONS root.video 660

```

It works for me.  Good luck.

----------

## agmoe

Great tip!

It works excellent and looks very nice, thanks!

----------

## ecatmur

 *NitroPye wrote:*   

> I think it should also be "-root" instead of "--root". I don't know though, because I cannot get it to work. I created the file /etc/devfs.d/nvidia.conf and added to it [code]/dev/nvidia* root:video 600[code] and I get an error on boot.

 No, it definitely is "--root" for skyrocket, though some screensavers use "-root" or something else even. 

Sorry for breaking your system, glad you managed to fix it. I guess I should have been more clear that that was the permissions to try to acheive, not the actual code to type in  :Embarassed: 

----------

## Souperman

```

BackgroundProgram=/usr/lib/xscreensaver/xmatrix -root -small -delay 20000

```

 :Mr. Green: 

----------

## NitroPye

Nah, I should have checked devfs.conf instead of just going... "OH my god its broke run away run away!!" ...  in a search for the holy grail  style.   :Very Happy: 

----------

## jkcunningham

Has anyone gotten this to work with xdm?

-jeff

----------

## Souperman

 *jkcunningham wrote:*   

> Has anyone gotten this to work with xdm?
> 
> -jeff

 

It's a feature specific to GDM, so no.  Feel free to add support and submit a patch.  :Wink: 

----------

## pathose

Those of you who've gotten this working, can you answer me this question?  Once you've logged in, the xscreensaver continue to run in the background or is that process terminated?  I know that when you log into gnome, xscreensaver is started, but it's launched as your user's process, whereas if it's acting as the background for gdm, it would (presumably) be run as gdm's process.  I ask because I would be interested in having a glx screensaver (from x11-misc/rss-glx) as my background, but I won't want it constantly running and hogging resources for nothing (while i'm not looking at the login screen).

----------

## ecatmur

The background program process is terminated on login, with SIGTERM.

This means that you must ensure that any children of the background program have the SIGTERM signal propagated to them - this can be a problem when using a script as the background program.

However for xscreensaver hacks it will work fine.

----------

## timaios

 *RedDawn wrote:*   

> Does this work with kde....
> 
> I Like it but not enought to use the Gnome gdm crap thingi..
> 
> i dont like Gnome...   
> ...

 

I dont know how it works with kdm, but

when you are running KDE if you disable the icons on your desktop, and run any of the above commands ,you can have a screensaver running as your desktop. 

 I recomend "/usr/lib/xscreensaver/starwars -root -lines 0", which is a very light one

(3,4%cpu  on p4 1.9)!!!    :Very Happy: 

----------

## MighMoS

Is there someway to put this into a theme file?

----------

## ecatmur

Alterations to a config file? I doubt it, sorry.

----------

## peterton

Shouldn't editing /etc/X11/xdm/Xsetup_0 and adding a line /usr/lib/xscreensaver/xmatrix -root & be enough to get it working in xdm? Haven't tried it as I've got too many windows open and don't want to log out.

[edit]works   :Very Happy:  [/edit]Last edited by peterton on Tue Jun 29, 2004 2:08 pm; edited 1 time in total

----------

## dmitrio

I have copied this, with permission of ecatmur, to gentoo-wiki.com 

http://gentoo-wiki.com/TIP_Screensaver_in_Background

If you see anything that should be added or changed, feel free to do so. 

Thank you for a great HOWTO.

----------

## rcxAsh

Thanks for the tip!  I've actually been using this for a while since I saw this thread.  It worked flawlessly IIRC.. 

However, I recently decided to try it out with mplayer.

It works great (mplayer -rootwin -fs file.avi), but, I get no sound.  I tried specifying "-ao oss" and even added gdm to the audio group.  However, still no sound.  

I know that it isn't exactly the same thing that the original tip tried to achieve, but it's based on what I learned here.  Any ideas as to why mplayer has no sound when running as gdm?  

The only other solution that I can currently think of is to create a new user that seems to be able to use mplayer fine.  Then, make gdm run as that user.  However, I'd like that to be my last resort.

----------

## gemini91

Hi, I'am using this on 2 machines and it works great, except one of them has an Nvidia card in it. It works fine when the machine comes up, however if you login and then logout I lose the background. Both machines are running the same level of software except for the Nvidia drivers. Would anyone have some ideas on where to look for solving this?     Thanks, Don

----------

## brazentone

This trick works wonderfully for me, and I am quite pleased.

But I've been wondering what prevents the Graphical Greeter from possessing such an ability. Does anybody know what in the gdm architecture prevents the pretty graphical greeter from having a transparent background?

----------

## Epcylon

 *peterton wrote:*   

> Shouldn't editing /etc/X11/xdm/Xsetup_0 and adding a line /usr/lib/xscreensaver/xmatrix -root & be enough to get it working in xdm? Haven't tried it as I've got too many windows open and don't want to log out.
> 
> [edit]works   [/edit]

 

Atleast for me, after I logged in, it continued running in the background. That gets annoying really fast, so I added in some stuff to kill it once a user logs in.

I did it by creating a /etc/X11/xdm/Xstartup_0, with the following contents:

```

#!/bin/sh

killall xmatrix

/etc/X11/xdm/GiveConsole

```

and then changing the line in xdm-config that says

```
DisplayManager._0.startup:      /etc/X11/xdm/GiveConsole
```

to

```
DisplayManager._0.startup:      /etc/X11/xdm/Xstartup_0
```

Works like a charm! \o/

----------

## johabba

This is a really cool tip.

Has anyone gotten this to work with a 3D screensaver? 

"/usr/lib/xscreensaver/xmatrix -root" works.

"/usr/lib/xscreensaver/glmatrix -root" doesn't work. It just gives me a black screen.

----------

## jerrybme

 *johabba wrote:*   

> This is a really cool tip.
> 
> Has anyone gotten this to work with a 3D screensaver? 
> 
> "/usr/lib/xscreensaver/xmatrix -root" works.
> ...

 

works for me on my desktop with an ati 9800. However, I found that the screensaver continued to run as mentioned above.  The above fix is for xdm. I found that if I added a line to the /etc/X11/gdm/PreSession/Default script

```
killall glmatrix
```

The xscreensaver process is killed and resources aren't wasted.

You have to restart gdm for this to work

Cheers,

Jerry

----------

## frilled

You can do this with kdm, too. Just put the saver command in /usr/kde/{VERSION}/share/config/kdm/Xsetup and put a "killall" of your saver in /usr/kde/{VERSION}/share/config/kdm/Xstartup.

I have xplanet there  :Wink: 

----------

## bienchen

Hello,

Ive tried it with kdm...set Xsetup and Xstartup...

the good thing: glmatrix runs for me...

the bad thing: it blocks the login screen, btw it does not show up  :Sad: 

what should I do?

greetings,

bienchen

----------

## bienchen

lil tip: Dont forget to background your saver  :Wink: 

glmatrix -root &

Tata...

Why dont save the pid of the saver in a file and kill the exact id?

something like echo $! > /tmp/kdmbackground.pid, kill `cat /tmp/kdmnackground.pid`

Works for me!

----------

## Ryle

Seems to work ok for me except that I get a blank (grey) background for the first 30 seconds after gdm starts up before skyrocket kicks in.  I tried a different program (xeyes) to see if it was an xscreensaver problem but that took 30 seconds to appear as well.  Is anyone else having this issue?

----------

## gemini91

This started happining after going to Gnome-2.12.  Don

edit: It really started happening after Gnome 2.10.

edit: it also occurs on an Ubuntu system running Gnome-2.12

----------

## Adrastos

well, would be a gread thing, if it would work...

I am using gnome 2.12.1 and gdm 2.8.0.5

After manipulating the gdm.conf, nothing happened. I've also checked the /dev/nvidia0 and /dev/nvidiactl but both had permissions 666. 

There is also no nvida.conf,... nowhere on my system... well, I guess this howto is a little bit outdated, isn't it?

Has somebody an idea?

Adrastos

----------

## lyonsd

This is pretty neat, although I haven't tried it yet.  Just popping in so I can find this thread later.

What would be even cooler is to have a random screen saver pop up as the login screen.  But ONE will do for now!

----------

## Adrastos

All right... I am waiting  :Smile: 

----------

## lyonsd

 *bienchen wrote:*   

> Hello,
> 
> Ive tried it with kdm...set Xsetup and Xstartup...
> 
> the good thing: glmatrix runs for me...
> ...

 

Same problem using gdm - screen saver works fine, but no login window.  

```

$ grep -v ^# gdm.conf 

[daemon]

AutomaticLoginEnable=false

AutomaticLogin=

TimedLoginEnable=false

TimedLogin=

TimedLoginDelay=30

Greeter=/usr/libexec/gdmlogin

User=gdm

Group=gdm

LogDir=/var/log/gdm

PidFile=/var/run/gdm.pid

PostLoginScriptDir=/etc/X11/gdm/PostLogin/

PreSessionScriptDir=/etc/X11/gdm/PreSession/

PostSessionScriptDir=/etc/X11/gdm/PostSession/

DisplayInitDir=/etc/X11/gdm/Init

XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing

ServAuthDir=/var/gdm

BaseXsession=/etc/X11/gdm/Xsession

UserAuthDir=

UserAuthFBDir=/tmp

UserAuthFile=.Xauthority

StandardXServer=/usr/X11R6/bin/X

Xnest=/usr/X11R6/bin/Xnest -audit 0 -name Xnest

[security]

AllowRoot=true

AllowRemoteRoot=true

AllowRemoteAutoLogin=false

RelaxPermissions=0

CheckDirOwner=true

[xdmcp]

Enable=true

[gui]

AllowGtkThemeChange=false

[greeter]

Browser=false

MinimalUID=1000

IncludeAll=true

Logo=

DefaultWelcome=true

DefaultRemoteWelcome=true

BackgroundType=0

BackgroundProgram=/usr/kde/3.4/bin/keuphoria.kss -root &

RunBackgroundProgramAlways=false

Use24Clock=true

GraphicalTheme=gentoo-emergence

GraphicalThemes=circles

GraphicalThemeDir=/usr/share/gdm/themes/

GraphicalThemeRand=false

SoundOnLoginSuccess=false

[chooser]

HostImageDir=/usr/share/hosts/

Hosts=

Broadcast=true

Multicast=false

[debug]

Enable=false

[servers]

0=Standard

[server-Standard]

name=Standard server

command=/usr/X11R6/bin/X -audit 0 

flexible=true

[server-Terminal]

name=Terminal server

command=/usr/X11R6/bin/X -audit 0 -terminate

flexible=false

handled=false

[server-Chooser]

name=Chooser server

command=/usr/X11R6/bin/X -audit 0

flexible=false

chooser=true

```

And the reason I set the background program to /usr/kde/3.4/bin/keuphoria.kss instead of /usr/lib/misc/xscreensaver/euphoria is because when I run any of those GL screensavers in that directory I get the following error:

```

/usr/lib/misc/xscreensaver/euphoria: error while loading shared libraries: libMagick.so.6: cannot open shared object file: No such file or directory

```

----------

## lyonsd

re-emerging rss-glx fixed the libMagick.so.6 problem.

Still no login screen.

----------

## lyonsd

Hmmm...now it's working - go figure.    :Confused: 

----------

## dreamerme

For gdm 2.8, i had to set this in my gdm.conf:

```
[greeter]

BackgroundProgramInitialDelay=0
```

for the background program to start immediately.  See http://www.gnome.org/projects/gdm/docs/2.8/configuration.html for details.

----------

## Jasper-j

Wauw, this is a great tip. 

But I wanted to use a slideshow. Is there any way to configure the "random-picture"-folder for the gdm-user?

----------

## UberPinguin

Has anyone gotten this working on GDM 2.14?

----------

## pvar

Well I just made it work with the latest version of GDM (that's 2.16.4 for my arch) and it's really great!!

If anyone is interested, I can post the configuration files...

By the way, I wanted to use the screensaver glslideshow in combination with a specific set of pictures.

The only way to do it (at least the only way I could think of) was to alter the file "/usr/X11R6/lib/X11/app-defaults/XScreenSaver"

This file contains the Default settings (as implied by the name of the folder app-defaults) for any instance of xscreensaver.

What I did was to modify the "imageDirectoy" variable...

```
*imageDirectory:        /home/pvar/pictures/screensaver
```

That was enough to do the trick! When starting glslideshow from GDM, the screensaver usew the pictures I have stored in the directory mentioned above...

----------

## phate

Hm I don't have a gdm.conf at all with 2.18.4. So where to place this line of code?

----------

## timeBandit

 *phate wrote:*   

> Hm I don't have a gdm.conf at all with 2.18.4. So where to place this line of code?

 /etc/X11/gdm/custom.conf

----------

## phate

I tried it out, but it doesn't work. I get a simple login screen with a black background.

```
[greeter]

Use24Clock=ja

UseCirclesInEntry=true

GraphicalTheme=happygnome

GraphicalThemes=

Logo=

BackgroundScaleToFit=false

BackgroundColor=#76848f

ChooserButton=false

ConfigAvailable=false

BackgroundProgram=/usr/lib/misc/xscreensaver/glblur -root

BackgroundType=0
```

----------

