FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 01-18-2008, 02:19 AM
"David C. Chipman"
 
Default Detecting X at logon

Hi Joe,

On Thu, 17 Jan 2008 21:58:50 -0500
"Joe Tseng" <joe_tseng@hotmail.com> wrote:

> I'd like to have some GUI apps start when I log on but only if I'm
> using Xwindows. Is it possible I could have them called
> conditionally from bash_profile?
>

Interesting idea. But it wouldn't be .bash_profile you
want to change. Try .xinitrc. You may have to create one. Good luck,
though,


-David Chipman

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-18-2008, 02:41 AM
Cameron Simpson
 
Default Detecting X at logon

On 17Jan2008 21:58, Joe Tseng <joe_tseng@hotmail.com> wrote:
> I'd like to have some GUI apps start when I log on but only if I'm using
> Xwindows. Is it possible I could have them called conditionally from
> bash_profile?

Sure:

if [ -n "$DISPLAY" ]
then
start some X apps...
fi

But be sure you're understanding the login processes involved;
normally you don't need to do this, and it's probably a mistake.

Generally:

- a text mode login starts a login shell, which runs
your .profile (or, if you're using bash and have a .bash_profile,
then that - bash happily falls back to .profile, so I don't
waste effort on a .bash_profile)

- starting X from a text mode console, _after_ you've logged in,
using startx or xinit will run ~/.xinitrc; when it finished
the X server is terminated; your .profile has already been run
before this happens so you don't need it, and anything running
your .xinitrc _should_ be under X, so no checking needs doing

- logging in in a GUI takes a different path:
if you have one, your ~/.xsession file is run;
your .profile has _not_ been run, so probably it should be sourced
by ~/.xsession as the first action.
(This implies that your .profile should never do anything
interactive.)
Then the rest of the .xsession runs; when it finishes the X
session is over.

Notice that so far, you have no cause to start X apps from the .profile;
you put them in .xsession or .xinitrc, and no checking is needed.

Now, case 3 above doesn't mention the common case - users without a
.xsession. In this case the system default session is run. That starts
some kind of desktop environment. But, because many users easily shoot
themselves in the foot by putting syntax errors or interaction in their
.profile, it DOES NOT source the user's .profile. This is bad practice,
because it means that all the apps started from the desktop lack your
environment settings. Noatably, terminals won't, and for _that_ reason
most of the default desktops start LOGIN shells in new terminals. Gah!
You're already logged in! Why ways all that effort again. Well,
because the default desktop has shirked its duty and not run your login
stuff yet.

And _that_ is why you're thinking you need to modify your .profile.
But your desktop has betrayed you and confused you.

Myself, I have:
- .profile, to set up my environment
- .xinitrc, to run an X session, presuming my environment is ok
- .xsession, that sources /etc/profile, .profile and .xinitrc
This arranges things in the right order. When I open a new terminal,
it is a plain interactive shell and NOT a login shell.

Sieze control, as I have. Since the lifespan of your desktop is the
lifespan of the .xinitirc file the last command in that is generally to
run a window manager (or a full on desktop, such as gnome-session).

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

It's better, when you're racing with someone you don't know so well,
to stick to the inside line - it's easier to avoid the bits.
- Barry Sheene, bike GP commentator

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-18-2008, 01:55 PM
Karl Larsen
 
Default Detecting X at logon

max wrote:

Joe Tseng wrote:
I'd like to have some GUI apps start when I log on but only if I'm
using Xwindows. Is it possible I could have them called
conditionally from bash_profile?


I am not sure if this is what you mean or exactly what you want but go
to:

System>Preferences>Personal>Sessions>

you can add programs to startup here, I assume they would only come up
with X windows running. Also under Session Options you can have the
computer remember what programs are running.


-Max

Thanks Max, I have put Thunderbird and Firefox to start when
Xwindows is full up. It means I just wait for the mail to arrive.


Karl

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-18-2008, 01:55 PM
Karl Larsen
 
Default Detecting X at logon

max wrote:

Joe Tseng wrote:
I'd like to have some GUI apps start when I log on but only if I'm
using Xwindows. Is it possible I could have them called
conditionally from bash_profile?


I am not sure if this is what you mean or exactly what you want but go
to:

System>Preferences>Personal>Sessions>

you can add programs to startup here, I assume they would only come up
with X windows running. Also under Session Options you can have the
computer remember what programs are running.


-Max

Thanks Max, I have put Thunderbird and Firefox to start when
Xwindows is full up. It means I just wait for the mail to arrive.


Karl

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-18-2008, 03:24 PM
"max bianco"
 
Default Detecting X at logon

On Jan 18, 2008 9:55 AM, Karl Larsen <k5di@zianet.com> wrote:

max wrote:
> Joe Tseng wrote:
>> I'd like to have some GUI apps start when I log on but only if I'm
>> using Xwindows. *Is it possible I could have them called

>> conditionally from bash_profile?
>
> I am not sure if this is what you mean or exactly what you want but go
> to:
> System>Preferences>Personal>Sessions>
>
> you can add programs to startup here, I assume they would only come up

> with X windows running. *Also under Session Options you can have the
> computer remember what programs are running.
>
> -Max
>
* *Thanks Max, I have put Thunderbird and Firefox to start when

Xwindows is full up. It means I just wait for the mail to arrive.

Karl

I set it up the same way for amarok but I don't know if it solves the original problem. He is apparently booting to the CLI and occasionally starting x.* Well there is certainly one way to find out.


So many things to discover so little time.

-Max

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-20-2008, 12:41 AM
William Estrada
 
Default Detecting X at logon

Joe,

This is what init 5 is for. Add your programs to /etc/rc.d/rc5.d/.
Files that start with S are started when entering init 5 level.
Add something like 'S99My_Stuff'.

--
William Estrada
MrUmunhum@popdial.com
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum



Message: 9
Date: Thu, 17 Jan 2008 21:58:50 -0500
From: "Joe Tseng" <joe_tseng@hotmail.com>
Subject: Detecting X at logon
To: "For users of Fedora Core releases" <fedora-list@redhat.com>
Message-ID: <BAY117-DAV846743313AEA98A2CACB99B420@phx.gbl>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original

I'd like to have some GUI apps start when I log on but only if I'm using
Xwindows. Is it possible I could have them called conditionally from
bash_profile?



--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 01-20-2008, 02:10 AM
"Mikkel L. Ellertson"
 
Default Detecting X at logon

William Estrada wrote:

Joe,

This is what init 5 is for. Add your programs to /etc/rc.d/rc5.d/.
Files that start with S are started when entering init 5 level.
Add something like 'S99My_Stuff'.

There are problems with this. First of all, the OP wanted the
programs to start when he logged in, not when the system starts.
Second, this is not the way initscripts should be set up. If you are
interested, I can point you to the documentation on initscripts.


You are also going to run into problems with X security. The
programs are not going to be able to connect to the X server when
started this way. The programs would be trying to run while the
display manager is running - in other words, while the login screen
is being displayed. You would want them to run while the window
manager or desktop is running. (Even programs started by a user's
cron job can not normally connect to the X server.)


Mikkel
--

Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 

Thread Tools




All times are GMT. The time now is 10:39 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org