i3wm, or i3, is a lightweight tiling window manager that you can install on top of FreeBSD as it does not come with any desktop environments out of the box.
First, ensure that you have installed Xorg according to these instructions.
pkg update
pkg upgrade
pkg install xorg
Next, install the i3 window manager:
pkg install -y i3 i3lock i3status
pkg install dmenu
After installing i3, you will want to make it the default window manager when you run startx. To do that, create the .xinitrc file in the user's home directory with the line /usr/local/bin/i3:
echo "/usr/local/bin/i3" >> /usr/home/username/.xinitrc
chown username /usr/home/username/.xinitrc
where username is the user's username.
Note: You may come to a point where you just want to run the X windows system or have other window managers installed in addition to i3. Therefore, I have just renamed the file to .xinitrc.bak for now and launch i3 using the command xinit /usr/local/bin/i3.
I have tried just using the command xinit i3 since /usr/local/bin is in my PATH but that seems to throw an error about the config file already existing. I'll need to look into this further.
According to the Daemon Security website, if you are running FreeBSD in a VirtualBox virtual machine, like I commonly am, you should also run the following command to install Guest Additions:
pkg install virtualbox-ose-additions
Then, you need to edit your /etc/rc.conf file to include the following lines:
vboxguest_enable="YES"
vboxservice_enable="YES"
hald_enable="YES"
dbus_enable="YES"
In order for the kernel changes to take effect, you should also:
reboot
Once the machine has rebooted, log into the appropriate user account and run:
startx
to launch the i3wm window manager and follow the prompts from there.
Unfortunately, there seems to be an issue that does not create a complete config file which is stored in your ~/.i3 directory. To fix this, delete the existing config file via rm config and then perform the following command:
cp /usr/local/etc/i3/config ~/.i3/
to get the full configuration file. I also like to tweak the configuration file to make the change focus key bindings more consistent with vim:
set $up k
set $down j
set $left h
set $right l
bindsym Mod1+bracketleft split h #needed because you can't bind two actions to h
You can find my current config file here.
Sources:
1. http://www.daemon-security.com/2014/03/fbsd10desk-0327.html
2. https://bbs.archlinux.org/viewtopic.php?id=145134