View previous topic :: View next topic |
Author |
Message |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Sun May 18, 2003 12:10 pm Post subject: X startup script trouble |
|
|
hi all
does anyone know whether gentoo supports any standard user login scripts for X, something like the .bashrc file is for bash. I would have thought that what I wanted was the .xsession file - but after testing it, and then looking through all the X startup scripts, this is only looked at if you dont use the gentoo 'chooser.sh' scripts. in fact, as far as i can see there are no provided user startup scripts.
basically i'm asking if anyone has found anything to the contrary, cause that would make me very happy
thanks
david ac |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Sun May 18, 2003 12:55 pm Post subject: |
|
|
.xinitrc if you start with startx, .xsession if you use a log-in manager (like kdm,gdm). |
|
Back to top |
|
 |
toskala Advocate


Joined: 14 Dec 2002 Posts: 2080 Location: hamburg, germany
|
Posted: Sun May 18, 2003 2:13 pm Post subject: |
|
|
what the heck is chooser.sh? _________________ adopt an unanswered post
erst denken, dann posten |
|
Back to top |
|
 |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Sun May 18, 2003 2:30 pm Post subject: |
|
|
chooser.sh is found in the /etc/X11 directory.
when gentoo boots up it doesnt actually use either the startx script of the xinit script. if you don't believe me, check out your /etc/init.d/xdm script. it goes straight to whatever your loging manager is - i.e. kdm/gdm/xdm etc.
i think that these scripts in turn use the chooser.sh file - although i'm not sure.
Quite clearly though, these programs get info from the /etc/X11/Sessions/ directory, which i dont believe is a standard directory - implying some gentoo modifications of the official source.
looking through the scripts from chooser.sh onwards, it seems to me as if .xsession etc. are never called
somehow this does not seem to be something which i would consider a good thing! |
|
Back to top |
|
 |
toskala Advocate


Joined: 14 Dec 2002 Posts: 2080 Location: hamburg, germany
|
Posted: Sun May 18, 2003 2:34 pm Post subject: |
|
|
i never used a graphical login manager, but afaik /etc/rc.conf contains all you need to change whatever you want to use as graphical login manager.
but i would strongly suggest you, reading the documentation, this is what helped me out. _________________ adopt an unanswered post
erst denken, dann posten |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Sun May 18, 2003 2:46 pm Post subject: |
|
|
though i dont use a graphical login-manager im sure .xsession is used. just try it and u will see. |
|
Back to top |
|
 |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Sun May 18, 2003 2:48 pm Post subject: |
|
|
/etc/rc.conf only contains info about which login manager to use. any way, i'm looking for a script which can load things based on which user is logging in (like what the ~/.bashrc does when you load up bash).
i've already looked through the docs and unfortunately they dont shed n e light on the problem
also, i have tried creating a .xsession file with the following content
export TEST="hello"
and when i do an "export | grep -i test" on a loaded xterm - it is quite clear that there is no environement variable TEST, as there would be if .xsession was executed! |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Sun May 18, 2003 3:03 pm Post subject: |
|
|
i think i found it.the startscripts are in /etc/X11/Session and you have to tell X wich session to usr in your rc.conf! |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Sun May 18, 2003 3:47 pm Post subject: |
|
|
just took a look at my /etc/rc.conf:
Quote: | # XSESSION is a new variable to control what window manager to start
# default with X if run with xdm, startx or xinit. The default behavior
# is to look in /etc/X11/Sessions/ and run the script in matching the
# value that XSESSION is set to. The support scripts is smart enouth to
# look in all bin directories if it cant find a match in /etc/X11/Sessions/,
# so setting it to "enligtenment" can also work. This is basically used
# as a way for the system admin to configure a default system wide WM,
# allthough it will work if the user export XSESSION in his .bash_profile, etc.
#
# NOTE: 1) this behaviour is overridden when a ~/.xinitrc exists, and startx
# is called.
# 2) even if a ~/.xsession exist, if XSESSION can be resolved, it will
# be executed rather than ~/.xsession, else KDM breaks ...
#
# Defaults depending on what you install currently include:
#
# Gnome - will start gnome-session
# kde-<version> - will start startkde (ex: kde-3.0.2)
# Xsession - will start a terminal and a few other nice apps
|
|
|
Back to top |
|
 |
toskala Advocate


Joined: 14 Dec 2002 Posts: 2080 Location: hamburg, germany
|
Posted: Sun May 18, 2003 4:02 pm Post subject: |
|
|
why dont you simply believe the first post of ralph?
~/.xinitrc does exactly the thing you want to have, why dont you use it? _________________ adopt an unanswered post
erst denken, dann posten |
|
Back to top |
|
 |
curtis119 Bodhisattva


Joined: 10 Mar 2003 Posts: 2160 Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.
|
Posted: Sun May 18, 2003 5:37 pm Post subject: |
|
|
ralph is correct the ~/.xinitrc file is correct if you are using startx to start your x session.
Here is mine, I use blackbox. The .xinitrc file starts all my dockapps and then blackbox.
Code: |
xscreensaver &
wmix &
wmfire &
wmusic &
wmfsm &
wmifs &
wmweather+ &
mount.app &
cnslock &
bbkeys -i &
xmodmap -e 'keycode 111=F15' # PrntScrn &
blackbox
|
_________________ Gentoo: it's like wiping your ass with silk. |
|
Back to top |
|
 |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Mon May 19, 2003 1:43 am Post subject: |
|
|
ok, none of u seem to know quite what i'm trying to do
however today i stumbled across someone who has the same problem as me, and as it turns out he has already posted this as a bug in bugzilla
see: https://bugs.gentoo.org/show_bug.cgi?id=14872 |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Mon May 19, 2003 7:08 am Post subject: |
|
|
Quote: | ok, none of u seem to know quite what i'm trying to do |
well, propably youre right.
but just out of curiousitiy:
lets take your example
Quote: | export TEST="hello" |
if you chose for example XSession=Gnome in your rc.conf the Gnome-script in /etc/X11/Sessions is called.
So, why not just edit this script? isnt that exactly what you wanted to do, or am i just not able to see what youre trying to do? |
|
Back to top |
|
 |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Mon May 19, 2003 8:40 am Post subject: |
|
|
yeah, come to think of it, that would work - i think.
the problem though is that then the script is run for every user that logs in using that desktop environment. what i am looking for is a script that is run only for a specific user - like the .xession file would do if i was using startx.
considering such a thing doesnt exist however, i might try doing as u suggest - and maybe add in an if clause to exclude other users  |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Mon May 19, 2003 8:59 am Post subject: |
|
|
Quote: | This is basically used
# as a way for the system admin to configure a default system wide WM,
# allthough it will work if the user export XSESSION in his .bash_profile, etc. |
not sure but maybe this could help.
also im still not sure if an .xsession in your homedirectory isnt called if you simply comment out XSession=... in your rc.conf.
as i said, im using startx so i never had this problem, but it might be worth giving it a try.  |
|
Back to top |
|
 |
curtis119 Bodhisattva


Joined: 10 Mar 2003 Posts: 2160 Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.
|
Posted: Mon May 19, 2003 3:06 pm Post subject: |
|
|
Quote: | ok, none of u seem to know quite what i'm trying to do |
Now I do.
Try this.
Make this script, I called mine 'curtis119start', put it in /usr/local/bin. Make it executable.
Code: |
export TEST='hello'
startx
|
This script sets all you're exports and whatnot and then at the end calls 'startx'. Make a different script for each user.
If you want a post X script to run when you quit X then:
make another script 'curtis119stop' and put it at the end of your .xinitrc script like this:
Code: |
xscreensaver &
wmix &
wmfire &
wmusic &
wmfsm &
#wmdf -bl -i 10 &
wmifs &
wmweather+ &
mount.app &
cnslock &
bbkeys -i &
xmodmap -e 'keycode 111=F15' # PrntScrn &
blackbox
curtis119stop |
this will run 'curtis119stop' after blackbox(or kde or gnome or whatever) quits. Put whatever you need in this script.
Doing it this way ensures that future system updates will not overwrite any of your scripts (which would happen if you modified any existing files like startx itself)
I tested this and it works perfectly.  _________________ Gentoo: it's like wiping your ass with silk. |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Mon May 19, 2003 3:38 pm Post subject: |
|
|
but if you're usin startx anyway wouldnt it be much easier to simply set up a .xinitrc in your homedirectory.
i tested it and it works fine.  |
|
Back to top |
|
 |
curtis119 Bodhisattva


Joined: 10 Mar 2003 Posts: 2160 Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.
|
Posted: Mon May 19, 2003 4:42 pm Post subject: |
|
|
Yes Ralph it does. I was using startx as an example because this is what I use. He wants to use xdm or whatever. This will work for him as well if he sets his mystart script to be the login manager and puts xdm as the last line in the script instead of using xdm as the login manager directly. Or kdm or gdm or whatever. I should have pointed this out but I thought he would understand. This is better than editing the /etc/X11/Sessions/Gnome script directly(as this will be overwritten ever time you upgrade). _________________ Gentoo: it's like wiping your ass with silk. |
|
Back to top |
|
 |
ralph Advocate


Joined: 02 Mar 2003 Posts: 2001 Location: Hamburg
|
Posted: Mon May 19, 2003 4:57 pm Post subject: |
|
|
Quote: | This will work for him as well if he sets his mystart script to be the login manager and puts xdm as the last line in the script instead of using xdm as the login manager directly. |
now i understand! good idea i think!  |
|
Back to top |
|
 |
davidac n00b

Joined: 25 Apr 2003 Posts: 27
|
Posted: Tue May 20, 2003 4:22 am Post subject: |
|
|
yeah, that seems to work fine!!
until the maintainers fix it so that there are proper startup files, that's probably a good way to do it! my main worry was that if i editted the files, they would get replaced every upgrade - and this gets around that
thanks everyone for the useful advice
david ac |
|
Back to top |
|
 |
grant.mcdorman Apprentice


Joined: 29 Jan 2003 Posts: 295 Location: Toronto, ON, Canada
|
Posted: Tue May 20, 2003 6:07 pm Post subject: Per-user startup scripts |
|
|
Quote: | This will work for him as well if he sets his mystart script to be the login manager and puts xdm as the last line in the script instead of using xdm as the login manager directly. |
Unless I'm misunderstanding the question, this won't do it. Rather, this will make the change for all users.
Remember, xdm is run once when the system boots. It starts the X server, and then displays a login box on the server*.
If you want something to be run when the user signs in via XDM, there are several ways of doing it:
KDE has a Startup folder (accessible from Konqueror's Go menu). You can drop any executable in here, including scripts (be sure to chmod +x). Unfortunately, I don't know if Gnome has an equivalent.
Alternative, you can modify /etc/X11/xdm/Xsession to source a particular file before invoking the desktop startup.
I do not think that the maintainers will "fix" this, as things are working as they are supposed to. If you are using gdm or kdm (the current standard X display managers for Linux), or the CDE display manager (commercial Unix systems such as Solaris) this is the correct behaviour - and it will work this way on all distros, not just Gentoo. .xsession is only used by the original X display manager, xdm.
*Footnote: Actually, the XDM (kdm, xdm, gdm) doesn't display the logon box directly. It runs another program which does. |
|
Back to top |
|
 |
|