Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.