Posted by Steve on Thu 2 Dec 2004 at 19:45
The majority of people who use Debian upon the desktop launch straight into the X11 Window system, usually via one of the choosers xdm, gdm, or kdm. Once you've entered your username and password you get your Window Manager running and are ready to start work. But what if you want a program or two to start as soon as you login?
The bigger desktop environments such as KDE or GNOME have their own facilities for starting programs when they load up.
In the case of KDE you simply place a shellscript, or symbolic link to an executable, into a special startup directory:
/home/username/.kde/Autostart
This will be executed at login time.
For GNOME you can use the control center. Go to the Control Center and select the sessions option. Inside there use the Session Properties & Startup section to choose the 'Startup Programs' tab. This allows you to add new programs to run at startup.
But what about causing programs to run if you're not running those environments?
Well the choosers gdm, kdm and xdm all support a standard startup system.
These choosers use XSession to run programs either globally or per-user when you login.
The global options are suitable if you wish to run a program for any user who logs into your machine, the per-user settings only apply to yourself.
Global options are the simplest ones. Simple place a shell script (make it executable) into the directory /etc/X11/Xsession.d
The files in the Xsession.d are executed in the order they are found - which explains why you might find some scripts located there already with numbers in their names.
I almost always want to have a terminal open and the music player xmms running when I login. I can achieve this by saving following shell script as /etc/X11/Xsession.d/startup-local
#!/bin/sh xmms & xterm &
Make it executable with:
chmod 755 /etc/X11/Xsession.d/startup
Notice that you must put the commands to run in the background? If you don't do that then your window manager will not start until after those programs have exitted.
If you just want to do this for yourself you can achieve the same thing by saving the script to run as ~/.xsession:
#!/bin/sh xmms & xterm &
(Again making it executable).
This is the per-user configuration file and will only affect you.
Either of these systems allow you to start programs automatically with the leighter weight Window Managers such as my personal favorite IceWM.
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
I know this is off topic but I really just want to say thank you for the articles. I have only been running my own server for a few months, which is when I started using Debian. And there are just lots of little things that this site has helped to point out. Nathan Bullock
[ Parent ]