LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-17-2009, 09:36 AM   #1
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Rep: Reputation: 0
Running xscreensaver automatically on login


Hi there.

New to LQ.org and fairly new to Linux, so sorry for the basic question and my lack of understanding. I have a Acer AspireOne running "Limpus Lite" based on Fedora 8 and using XFCE4 desktop environment. The question is, how do I make the xscreensaver daemon run automatically on logon?

I have been reading around for about a week and have tried a number of things but to no avail. I have tried using the xfce4-autostart-editor but this doesn't appear to do anything, nor does adding a line to the /etc/rc.local script which reads:

Code:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
setpci -d 197b:2381 AE=47

/usr/local/bin/acerfand

/usr/bin/xscreensaver &
Without this xscreensaver is not running in the background, and when I start the xscreensaver-demo app I get the message "The XScreenSaver daemon doesn't seem to be running on display ":0.0". Launch it now?"

Can someone please suggest a reason for this not working from rc.local, or suggest the proper way of autostarting the xscreensaver daemon?

Thanks, James
 
Old 05-17-2009, 02:04 PM   #2
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
On Slackware I had the same problem when using Fluxbox. It did not need it with KDE or XFCE.

Try editing the .bash_profile:

Quote:
tux3@morningstar:~$ cat .bash_profile
if [ $TERM != linux ]
then
exec /usr/bin/xscreensaver -nosplash &
fi
 
Old 05-18-2009, 12:35 PM   #3
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Smile

Hi Chris, thanks for your reply. I will try editing the .bash-profile file as you suggested however would you mind giving me a brief explanation of what the if statement is doing? (Just so that I know, for future reference - I have basic knowledge of some programming but that's it!)

Code:
if [ $TERM != linux ]
Also, I'm guessing the first line:
Quote:
tux3@morningstar:~$ cat .bash_profile
should be omitted from my code?

Cheers.
 
Old 05-18-2009, 04:58 PM   #4
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Well, that seems to have worked! Thank you Chris.

So a question then (or two):

What is the purpose/role of the .bash_profile file?

and

How come the command doesn't work in the rc.local file? I understood that that was the place to put things like that.

I would be grateful if anyone could shed some light on this, it would help me understand more about how it all works!

Many thanks, James
 
Old 05-19-2009, 02:14 AM   #5
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
Hi James,

1. The TERM flag depends on your your TTY. Thus if you log in VT1 (CTRL+ALT+F1)

$ echo $TERM
linux

This avoids launching the screensaver on a VT1, and therefore errors. Acturally it does not protect you from logging in as a different user and then switching back to the first user on a Terminal Emulator on VT7 (or wherever your X runs).

$ login: user2
$ su - user1

so I modified the first line as follows:
Quote:
if [ "$(tty)" == "not a tty" ]
2. The "cat" line was just a way to show what is in a file, like "type" in dos, so:

$ cat .bash_profile

shows you what you have written in .bash_profile

3. The purpose of .bash_profile is slightly disto-dependent, but in general it generally gets executed immediately after you log in.

4. rc.local is executed before you log in. The computer does not know where and to whom it should launch the xscreensaver, so it fails.

Just an additional comment/question because all this should not be necessary with XFCE.

I would assusme that if something works on a basic distro like my Slack it should work on Limpus. Do you get a small window prompting you to save your session (or otherwise) when you log out from XFCE? In theory, all you need to do is start once the xecreensaver daemon, then save you session. If you do not get prompted, then check under the Settings >> Session and Startup >> Genral (Tab) >> Prompt on logout (or Automatically save session on logout) menu.

Also I do not do any programming, but I have some basic knowledge on shell scripting... it helps.

Cheers
Chris
 
Old 05-19-2009, 04:37 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
While this is possible, is not just easier to just use whatever mechanisms your wm has to autostart programs?

If my memory serves correctly, for fluxbox it's ~/.fluxbox/startup. For kde it would be ~/.kde/Autostart... just check the docs for your wm.

If you use "startx" to launch your wm or desktop you could also use ~/.xinitrc.
 
Old 05-19-2009, 01:31 PM   #7
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Sorry Chris, I think you lost me a bit with TTY, VT1, VT7 but not to worry. The "if [ $TERM != linux ]" line worked for me so I might just leave it at that.

I presume, therefore, that the .bash_profile file is user specific (also because I found it residing in /home/user) - is this correct? So if I had multiple users I would need to recreate the xscreensaver code in each .bash_profile file?

I understand now why the command did not work in the rc.local file.

With regard to saving the session, no I have never had a prompt asking me if I want to save the session. Also, if I go to Settings >> Sessions and Startup Settings (by right-clicking on the desktop), I get an error which reads:

"Xfce Settings Manager error: No such plugin "session""

I don't know what you know about Linpus OS supplied with the Acer Aspire One, but out of the box it is very much locked down, providing the general user a basic but functional environment. After reading a fair bit on the internet I have been able to enable the "advanced mode" to get to the right-click context menu, find the package manager, turn on a login screen, enable Compiz WM, change desktop icons and shortcuts to other apps, amongst amongst other 'fun' little tweaks. Hence I have learned what type of DE lay behind the scenes and got a feel for the many different flavours and distros of Linux out there. Btw, I discovered Ubuntu a while back which I am running (dual-boot) on my desktop. I guess the point of all this is that I guess there should be a Xfce session manager that would allow me to change session settings, but it doesn't appear to be working/installed.

As you said, some basic knowledge in shell scripting is very useful, but I currently have none. This is obviously where should start reading properly :-) (Can you suggest a good resource as a starting point?)

Thanks for your help!
 
Old 05-19-2009, 01:37 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by mrhappy5 View Post
As you said, some basic knowledge in shell scripting is very useful, but I currently have none. This is obviously where should start reading properly :-) (Can you suggest a good resource as a starting point?)
This one is good for that: http://tldp.org/LDP/abs/html/
 
Old 05-19-2009, 01:38 PM   #9
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
While this is possible, is not just easier to just use whatever mechanisms your wm has to autostart programs?

If my memory serves correctly, for fluxbox it's ~/.fluxbox/startup. For kde it would be ~/.kde/Autostart... just check the docs for your wm.

If you use "startx" to launch your wm or desktop you could also use ~/.xinitrc.
As I said I am learning all the time with this by playing around (breaking things and learning how to fix them - my usual style!), so I only know about the mechanisms I have come across so far. In Xfce I found a "autostart-editor" tool which appeared to be what I needed, but I found it didn't work. It does contain a lot of the apps that are running from bootup such as network manager, keyboard/input manager, battery meter etc. but adding an entry for xscreensaver failed. I wonder whether that's because xscreensaver seems to be a user-specific program?

I have found an "autostart" directory somewhere on the system (I've currently forgotten where that was) but I didn't know what to do with it. As you can tell I'm still and absolute beginner!

Cheers, James
 
Old 05-19-2009, 01:40 PM   #10
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by i92guboj View Post
This one is good for that: http://tldp.org/LDP/abs/html/
Thanks, it's saved in my bookmarks and I will read into it!
 
Old 05-21-2009, 02:20 AM   #11
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
Quote:
I presume, therefore, that the .bash_profile file is user specific (also because I found it residing in /home/user) - is this correct? So if I had multiple users I would need to recreate the xscreensaver code in each .bash_profile file?
Yes, .bash_profile is user specific. Actually it does not have to be!

Just copy it in /etc/skel/ and new users you define will inherit it automagically.

I apologize if my explanation was un-intelligable, but maybe this is not the right media to learn about Terminals and stuff or maybe I am not the right person.

I do not know anything about Limpus except what I read on distrowatch.com. I must say that from what you are writing I am not very impressed as there are great XFCE distros, like Debian Xfce, Xubuntu, Vector and Zenwalk etc (and even Slackware) but none of these is based on Fedora.

Chris
P.S. Apologies to all the other great XFCE distros I did not mention.

Last edited by ChrisAbela; 05-21-2009 at 02:23 AM.
 
Old 05-22-2009, 01:51 PM   #12
mrhappy5
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Actually, it turns out there is already a .bash_profile file in /etc/skel but I tried putting the same code in this one and I'm not sure that it worked. Ah well, you solved my problem anyway so I'm happy, thanks again.

With regard to Linpus and other xfce based distros, I'm sure there are some much more "user-friendly" versions, that are nicer (and safer!) for intrigued newbies like myself. The trouble is I just can't bring myself to ditch it on my Aspire One yet, since it does work with the hardware perfectly, so despite it being rather clunky I'd rather live with it, learn with it than expend a lot of effort starting from scratch with something that would operate slicker but wouldn't function with the hardware as well. I've read a bit of stuff about people rushing into putting Ubuntu on it and ending up with broken hardware functions.

James

Last edited by mrhappy5; 05-22-2009 at 06:32 PM.
 
Old 05-22-2009, 02:35 PM   #13
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
Hi James,

This script seems to be one starting Xfce for you!

Yes go ahead and add
exec /usr/bin/xscreensaver -nosplash &
before the last "fi"

I understand ..... hardware detection can be a pain.

Chris
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting the xscreensaver daemon automatically in Etch swampdog2002 Debian 1 03-28-2008 09:03 PM
Running Xscreensaver at Startup burningsun1981 DamnSmallLinux 1 07-04-2005 01:04 AM
quick q: KDE + KDM: automatically running a program after login atom Linux - Software 2 04-12-2005 08:50 AM
failed xscreensaver login when x down? Chuck23 Linux - Security 4 02-23-2005 09:47 PM
running xscreensaver on bochs zaman Linux - Software 0 10-15-2003 08:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration