Jump to content

How to run script when Xsession starts?


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

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:



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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...