# Configuring X to use XDM with Xmonad



## BinaryMage (Oct 25, 2011)

I've been trying to setup my laptop, which has a fresh install of FreeBSD 8.2-RELEASE, up with XDM and Xmonad, and am having some issues.

First, *uname -a* output:

```
FreeBSD thinkpad-t42p.domain.actdsltmp 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011 
root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
```

I'm not very familiar with X configuration, but excessive Googling seemed to indicate that I needed a .Xsession file in my /usr/home directory, and that such a file would do the job. I did indeed create such a file; contents displayed below.


```
# .xinitrc

xrandr -s 0

xrdb $HOME/.Xresources
xsetroot -cursor_name left_ptr
xsetroot -solid '#80a0af'

PATH=/home/binarymage/bin:$PATH

# launch clock and status bar
FG='#a8a3f7' 
BG='#3f3c6d' 
xmonad-clock | dzen2 -e '' -x 400 -w 1200 -ta r -fg $FG -bg $BG &

xmonad &

wait $!
pkill -HUP dzen2
pkill -HUP -f xmonad-clock
wait
```

I have no idea if the above is correct to run xdm and Xmonad, I just used a modified version of what I found here, with what looked to me like personal configuration options I didn't want removed.

Now, my first problem: When I boot up my system, before I can login via the terminal, XDM launches and gives me a login prompt, but when I enter my username and password, it gives a black screen for a few seconds and then returns to the login prompt. I think, again based on Googling, that this means my display managers hasn't been configured properly. But since my configuration file is in my home directory, I guess it isn't being read by X on startup. (I can't *startx* after logging in because there is already a session running, and *pkill xdm* just seems to restart it).

Help on how to properly configure Xmonad to run with XDM, preferably on bootup, would be most appreciated. 

Best regards,
BinaryMage


----------



## SirDice (Oct 25, 2011)

X isn't configured correctly. Fix that first before moving on to XDM or Xmonad.

No need to google: Handbook: 6.4 X11 Configuration


----------



## adamk (Oct 25, 2011)

Disable xdm entirely.  Whatever you did to enable it, undo it.  Then try to run [cmd=""]startx[/cmd] and see if X starts properly.

Adam


----------



## wblock@ (Oct 25, 2011)

startx uses .xinitrc.  xdm uses .xsession.

But agreed, disable xdm startup in /etc/ttys and use startx until it starts correctly.  Then copy .xinitrc to .xsession and enable xdm.


----------



## SirDice (Oct 25, 2011)

wblock@ said:
			
		

> Then copy .xinitrc to .xsession and enable xdm.


To save yourself some trouble you can also symlink them.


----------



## BinaryMage (Oct 26, 2011)

Alright, thank you all for the excellent and prompt advice. 

I did as you suggested and disabled xdm startup in etc/ttys.

Executing `$ startx` now starts X successfully. Thanks again, and sorry for the newbie question.

Best regards,
BinaryMage


----------

