The year of OpenBSD desktop

OpenBSD Desktop Setup

Setting up X

xenodm

During the install script, you had to choose to enable or not xenodm. In case you didn’t, you can manually enable it to launch at startup.

# rcctl enable xenodm
fig. Enable xenodm.

Laptop specific tweaks

Disabling the touchpad while typing

The touchpad is still enabled while the user types. This can be extremely frustrating on some configurations. On my {baston MacBook}, I touch the trackpad quite often with my thumb.

syndaemon can idle the mouse while you type. It is trivial to daemonize it.

#!/bin/sh
syndaemon -i 0.5 -d
fig. Content of $HOME/.xinitrc.

Automount USB stick

hotplug is the perfect tool for this task. First, enable the service.

# rcctl enable hotplugd

Create the attach and detach script.

#!/bin/sh

DEVCLASS=$1
DEVNAME=$2
MOUNTROOT="/mnt"
DEBUG=0

case $DEVCLASS in
2)
	# disk devices
	disklabel=`/sbin/disklabel $DEVNAME 2>&1 | \
	sed -n '/^disk: /s/^disk: //p'`
[ $DEBUG == 1 ] && logger -i "hotplugd descovered DISKLABEL $disklabel"
	case $disklabel in
	"SCSI disk")
		slices=`/sbin/disklabel $DEVNAME 2>&1 | \
		sed -n '/^ *[abd-z]: /s/^ *\([abd-z]\):.*/\1/p'`
		for slice in ${slices}; do
[ $DEBUG == 1 ] && logger -i "hotplugd attaching SLICE $slice of DEVICE $DEVNAME"
			[ ! -d $MOUNTROOT/$DEVNAME$slice ] && mkdir -p -m 1777 $MOUNTROOT/$DEVNAME$slice
			mount /dev/$DEVNAME$slice $MOUNTROOT/$DEVNAME$slice
		done
		;;
	esac
	;;
3)
	# network devices; requires hostname.$DEVNAME
	sh /etc/netstart $DEVNAME
	;;
esac
fig. Content of /etc/hotplug/attach
#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
    2)
        /sbin/umount "/mnt/$DEVNAME"
    ;;
esac
exit 0
fig. Content of /etc/hotplug/detach

Make them executable and start the service.

# chmod 0775 /etc/hotplug/attach
# chmod 0775 /etc/hotplug/detach
# rcctl start hotplugd

Questions or corrections? Send an email to roy@royniang.com.

1 incoming links

install openbsd