Jump to content

How to run script when Xsession starts?


boatman9
 Share

Recommended Posts

In Gnome, System --> Preferences --> Sessions or Startup Applications

 

name varies from versioning of Gnome, previously was Sessions, but in Mandriva 2010 I see Startup Applications.

Link to comment
Share on other sites

Thanks for the advice. I am using Gnome but probably will be using KDE4 soon.

 

I had put my xrandr commands in .bash_profile where it seems to be doing OK. I would prefer not to have the script in user's space, but someplace that will apply to all users, as it does in the Debian example.

Link to comment
Share on other sites

In Archlinux the appropriate file for that is /etc/rc.local

I don't really know if this is the right place for Debian- Arch may be a regular Linux distro, but it does have a few peculiarities: No init runlevels (just runlevel 3 and runlevel 5) and the initscripts use BSD-like hierarchy rather than Linux one.

Edited by scarecrow
Link to comment
Share on other sites

In Mandriva:

 

/etc/rc.d/rc.local

rc.local runs directly after rc.sysinit and all other scripts in /etc/init.d/, but this will usually be well before anybody has logged in apart from root and a few daemons. Thus putting commands here to play with X may be less useful.

 

The following scripts are sourced from your own ~/.bash_profile or ~/.bashrc, but cannot be touched by mere mortals: /etc/profile.d/ or /etc/bashrc. The .bash_profile (and for Mandriva by extension also /etc/profile.d/*) is executed after every logon and also calls .bashrc. In addition .bashrc (by extension /etc/bashrc) is executed after start of every terminal session (so additional KTerm, rxvt, Gnome-terminal etc that you start after logging in). This also means that they are executed when you log into a (non-X) console.

 

I have put my X-related 'after-logon' activities in ~/.config/xfce4/xinitrc, but I do not know how this would translate from my DE (XFce4) to Gnome, KDE or other DE's. I have also found a bunch of scripts in /etc/X11/xinit.d/ that looks like they are /etc/bashrc and /etc/profile.d/ equivalents, i.e. executed after start of X on system level. This is an assumption; I am not certain of that...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...