Autostart Programs

From Gentoo Linux Wiki
(Redirected from HOWTO Autostart Programs)
Jump to: navigation, search

Contents

[edit] 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.

[edit] 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:

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

[edit] KDE

[edit] Using Shell Scripts

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 contents for gaim:

File: ~/.kde/Autostart/gaim
#!/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.

[edit] Using symbolic links

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.

[edit] Xfce4

[edit] Using Shell Scripts

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: ~/Desktop/Autostart/gaim
#!/bin/bash
/usr/bin/gaim
chmod +x gaim

[edit] Using symbolic links

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

cd ~/Desktop/Autostart #since version 4.4 ~/.config/autostart

ln -s `which gaim`

[edit] 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 startupFile: ~/.fluxbox/startup file

Before the line exec /usr/bin/fluxbox

add /usr/bin/gaim &

[edit] 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:
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
.

[edit] 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

[edit] 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. AddToFunc InitFunction

add + I Exec exec /usr/bin/gaim

[edit] Enlightenment DR16

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

Since e16.8 you can use/create ~/.e16/{Start Stop Init} folders. All you need to do is: create the folder(s) enable user session scripts in e16 menu -> Session Settings create a link/script in one of the folders

thats it

[edit] 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

File:
 
[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

[edit] WindowMaker

Programs that you wish to autostart on WindowMaker startup need to be placed into ~/GNUstep/Library/WindowMaker/autostart

This should only be used for non-X applications or applications that do not support session management. Other applications should be restarted by the WindowMaker session restoring mechanism. WindowMaker will wait until this script finishes, so if you run any commands that take long to execute (like a xterm), put a "&" in the end of the command line. This file must be executable.

[edit] JWM

In JWM; the configurations are store in XML format. and this make all things possible. All the configuration stores in $HOME/.jwmrc. at the END of this file do this:

gvim ~/.jwmrc
chmod a+x /path/to/autostart.sh
File: ~/.jwmrc
<StartupCommand>sh autostart.sh</StartupCommand>

and in autostart.sh add what you need to run at the start up like (sleep 3 && /usr/bin/nm-applet --sm-disable) & (sleep 4 && parcellite) & (sleep 4 && volumeicon) & and you are good to go!!!


[edit] WMFS

Thanks to xorg62; start-up applications in the WMFS is easy. you could do it with background_command in wmfsrc. you could start the executables programs this way. Either one program per background command or put all of your programs that you wish to start at start-up and make that file executable then address it in background_command. what ever fine with you. the full description is in link WMFS WIKI. Look carefully where the background_command is located in wmfsrc. ( wmfs is really nice among tilling windows manager in that way. every commands and attributes have tier own place.)

[root]
	background_command = "~/.config/wmfs/autostart (or autostart.sh)"

	[mouse] button = "3" func = "menu" cmd = "rootmenu" [/mouse]
[/root]


chmod a+x ~/.config/wmfs/autostart.sh


There is no more [root] section in WMFS2. WMFS2 wiki says:

"the easiest way to display datas in the statusbar is by a script launched on startup (with ~/.xinitrc): status.sh"

[edit] 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.

Personal tools