Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to start a few applications right after my wm (dwm) loads, where can I put my script so this happens? I'm on Ubuntu 12.04 LTS and using dwm.

share|improve this question

You can put customizations in a file called ~/.xinitrc. This is meant for when you start Xorg with the startx command. If you are running a display manager instead, you will need an ~/.xsession script instead.

According to the Ubuntu wiki page CustomXSession, you can just symlink those two files.

As an example, here is my ~/.xinitrc;

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

export XCURSOR_THEME=redglass

# Set language stuff
export LANG=en_US.UTF-8

# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

# set mouse accelleration parameters
xset m 3/1 4
# set keyboard repeat rate
xset r rate 200 60

# Allow local access to the X server.
xhost +local:

# Load my customizations.
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
setxkbmap -option compose:rwin
pulseaudio --start
xstdcmap -best
Esetroot ~/.backgrounds/endurance_crater1920.png

# start the window manager. This _must_ be the last command
# and it _must_ be run with exec!
exec i3

You can add commands to this file before you run the window manager. You can put the commands in the background by appending ' &' to them.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .