Search:  
Gentoo Wiki

HOWTO_Autostart_Programs


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

This HOWTO explains how to get programs to launch when you login into your WM (Window Manager) and/or DE (Desktop Environment).

NOTE: New users should note that ~ equals user's home directory. Also note that these instructions should work on these Window Managers on most Distributions in addition to Gentoo.

GNOME

Programs that you wish to autostart on GNOME startup can be selected by using the Control Center. To do this, open the Control Center and then navigate to Sessions followed by Startup Programs. Click Add and either type the path, or use Browse to select your desired program[s]. If multiple programs are selected, they can be launched in a desired order.

If the GUI is not available or desireable, then one can instead modify ~/.gnome2/session-manual. Syntax is as follows:

File: ~/.gnome2/session-manual
[Default]
num_clients=1
0,RestartClientHint=3
0,Priority=50
0,RestartCommand=gdesklets
0,Program=gdesklets

KDE

Programs that you wish to autostart on KDE startup need to be placed into ~/.kde/Autostart.

Below is an example of autostarting GAIM written in bash.

cd ~/.kde/Autostart
nano -w gaim (example script below)
File: Example script
#!/bin/bash
/usr/bin/gaim
chmod +x gaim

Below is an alternative for the same example, this time using a soft link.

cd ~/.kde/Autostart
ln -s /usr/bin/gaim gaim

You can also put .desktop files here. For example, you can drag a shortcut from the K Menu.


Alternative KDE Explanation

To Autostart a program in KDE you simply need to put a symbolic link to the executable file in the Autostart directory. In most cases this is located at:

   ~/.kde/Autostart/

If wanted to have xbindkeys start automatically when KDE started then I would locate the the executable file for xbindkeys. In my installization it is located at:

   /usr/bin/xbindkeys

All you have to do is place a symbolic link in the Autostart directory:

   ln -s /usr/bin/xbindkeys ~/.kde/Autostart/xbindlink

This command creates a link named "xbindlink" in the Autostart directory that links to the executable located in the /usr/bin/ directory.

Restart KDE and you should be in business.

I hope this helps.

Xfce4

Programs that you wish to autostart on Xfce4 startup can be selected by using the xfce4-autostart-editor tool available in Xfce4 menu > Settings > Xfce 4 Autostarted Applications.

If the GUI is not desirable, you can put .desktop files in the ~/.config/autostart/ directory. If this directory does not exist, simply create it.

Note: In the Xfce versions prior to 4.4 the programs had to be located in ~/Desktop/Autostart.

Below is an example of autostarting GAIM written in bash.

cd ~/Desktop/Autostart #since version 4.4 ~/.config/autostart
nano -w gaim (example script below)
File: Example script
#!/bin/bash
/usr/bin/gaim
chmod +x gaim

For a simpler approach, a link will work as well:

cd ~/Desktop/Autostart #since version 4.4 ~/.config/autostart
ln -s `which gaim`

Fluxbox

Programs that you wish to autostart on Fluxbox startup need to be placed into ~/.fluxbox/startup and fluxbox needs to be started with startfluxbox

To start Fluxbox locally or globally with startx, ensure that your ~/.xinitrc (for local) or /etc/X11/xinit/xinitrc (for global) file contains the line:

File: ~/.xinitrc or /etc/X11/xinit/xinitrc
 
startfluxbox
  


If you want to add something to the startup list, make sure it has an "&" at the end of the command line.

Below is an example of line you need to add to autostart GAIM.

cd ~/.fluxbox
nano -w startup
File: ~/.fluxbox/startup file

Before the line

exec /usr/bin/fluxbox

add

/usr/bin/gaim &

IceWM

IceWM is very similar to Fluxbox in that you have a script that is executed when IceWM starts up, simply add all the commands you'd like executed to ~/.icewm/startup. Note that since this is executed as a script all programs should either detach themselves or be backgrounded.

Unlike Fluxbox however this script does not need to start up IceWM itself. The file should be a well-formed script, e.g.:

File: ~/.icewm/startup
#!/bin/bash
audacious &
gkrellm2 &
psi &
xscreensaver -no-splash &

And of course, it should be marked as executable: chmod a+x ~/.icewm/startup.

PekWM

PekWM is very similar to IceWM and Fluxbox in that you have a script that is executed when PekWM starts up, simply add all the commands you'd like executed to ~/.pekwm/start. Note that since this is executed as a script all programs should either detach themselves or be backgrounded.

Unlike Fluxbox however this script does not need to start up IceWM itself. The file should be a well-formed script, e.g.:

File: ~/.pekwm/start
#!/bin/bash
audacious &
gkrellm2 &
psi &
xscreensaver -no-splash &

And of course, it should be marked as executable: chmod a+x ~/.pekwm/start.

FVWM

Programs that you wish to autostart on FVWM startup need to be placed into ~/.fvwm/.fvwm2rc

Below is an example of line you need to add to autostart GAIM.

cd ~/.fvwm
nano -w .fvwm2rc

After the line, if non-existing, add it.

File:
AddToFunc InitFunction

add

+ I Exec exec /usr/bin/gaim

Enlightenment DR16

  1. Start the application you wish to autostart (e.g. gkrellm2).
  2. Alt + right click anywhere in the application's window.
  3. Select "Remember..." from the context menu. A menu called "Remembered Application Attributes" will appear.
  4. At the bottom of this window, check the "Restart application on login" checkbox.
  5. Click "Apply" then "OK".

Since e16.8 you can use/create ~/.e16/{Start Stop Init} folders. All you need to do is:

  1. create the folder(s)
  2. enable user session scripts in e16 menu -> Session Settings
  3. create a link/script in one of the folders

thats it

Enlightenment DR17

Note: Recent versions of e17 don't use eap files anymore but ordinary .desktop-files. Just substitute .eap with .desktop and forget the part about creating eap-files.

Code: example file for gnome-settings-daemon
 
[Desktop Entry]
Encoding=UTF-8
Name=Gnome-Settings Daemon
Exec=/usr/libexec/gnome-settings-daemon
StartupNotify=false
Type=Application
  

Programs that you wish to autostart on Enlightenment DR17 startup should have their corresponding .eap file listed in ~/.e/e/applications/startup/.order

Below is an example of making GAIM autostart:

Code: Add existing .eap file to startup list
 
 echo "gaim.eap" >> ~/.e/e/applications/startup/.order
  

This, obviously, relies on the application you wish to autostart having a .eap file to begin with! (There's a full list at ~/.e/e/applications/all) If that isn't the case, you can create one (here we're going to execute a simple script to start the Beagle daemon):

Code: Create new .eap file
 
 cd ~/.e/e/applications/all
 e_util_eapp_edit beagled.eap
  

This will launch a dialog: we need to set the App Name to 'beagled' and the Executable should point to our script (in my case its ~/bin/beagled.sh: obviously you should set appropriately).

Finally, we need to add out new .eap to the startup list:

Code: Add new .eap file to startup list
 
 echo "beagled.eap" >> ~/.e/e/applications/startup/.order
  

Notes

When adding to this HOWTO, please use the variable ~ to indicate the users home directory. Please add to this HOWTO if there's an enviroment that you use that's not listed here.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Autostart_Programs"

Last modified: Fri, 05 Sep 2008 03:55:00 +0000 Hits: 84,587