Part 4: The SLiM Graphical Login Manager
If you’re like me, you probably don’t want to run X11 every single time you use your system. Sometimes all you need is the console. If, however, you like to be greeted by a familiar desktop when you boot up your computer, a graphical login manager (more correctly known as an X display manager) is for you.
For this task, we’re going to use SLiM, the Simple Login Manager. Unlike many graphical login managers, SLiM is independent of any window manager or desktop environment, meaning we can use it with not only Window Maker, but also any alternatives that we might put in Window Maker’s place.
SLiM is available in FreeBSD’s pre-compiled binary package system, which you were introduced to earlier in this tutorial by the command
pkg. We can tell that SLiM is available by using either the
pkg search command, or by checking FreshPorts, an online repository of all of the packages and ports included in FreeBSD. SLiM can be found on FreshPorts here.
Installing and setting up the default SLiM configuration is incredibly simple. First, in your open xterm window, enter the following to install SLiM. It doesn’t have many dependencies, so it should download and install in no time at all.
doas pkg install x11/slim
Once that completes, use Doas and Vim to open the
/etc/rc.conf file. We need to be careful in this file, as it is a major system configuration file, and breaking it may prevent you from successfully booting FreeBSD.
I haven’t taught you how to move around in Vim yet, so now is the perfect time to do that. You may have noticed that the end of SLiM’s installation stated that you need to add
slim_enable=yes to the file you just opened. We also need to add two more lines to start two other system daemons that need to be ran at boot. We’re going to put them at the very bottom of the file.
Navigating in Vim can take a little getting used to, but it becomes second nature very quickly. We move around inside a text document using the
l keys. These respectively correspond to move the cursor left, down, up, and right, by a single character. Use the
j key to move to the very end of the file.
You will realise when you get there that we can’t move to a newline using this key. That’s because no blank line exists! To add a new line below the current line, and enter the insert mode on it, press the
o key. Alternatively, you can press
A to enter insert mode at the end of the current line, then use your return key to add a new line.
Whichever method you use, enter the following as the final three lines of the file, then write the file to your disk and quit Vim.
dbus_enable="YES" hald_enable="YES" slim_enable="YES"
Note: You won’t be able to use SLiM to log in as root unless you configure the
.xinitrcfile for root. To do that, use
F2to switch to a virtual console, then login as root and configure the file. Alternatively, you can use the virtual console to log in as root without configuring X11 for it at any time. Use
F1to return to the original screen.
We aren’t going to see SLiM until we restart the system, so feel free to do that now if you wish. You will be greeted by the screen shown below, which you can use to log in to your user account.
After logging in, SLiM will automatically launch X11. You’ll be sent straight to your Window Maker environment, rather than the command line console. How neat is that?
Now that everything is set up, you can launch xterm and enter
doas poweroff to shut down your system. After all those drinks you had waiting for things to install, using the powder room around about now might not be the worst idea.
Concluding Configuring FreeBSD for Desktop Usage
And that’s it! Now you have a functioning FreeBSD system that uses Window Maker and SLiM to offer you a workspace system similar to a traditional desktop. As I stated at the beginning of this tutorial, there are other window managers, login managers, and desktop environments out there.
Stay tuned for my next FreeBSD post, in which I will explore further desktop usage, including setting up an email client, browser, and office suite, as well as configuring some networking and firewall essentials.
Here’s some further reading that you can explore:
- XWINMAN, a guide to window managers and desktop environments for The X Window System.
- Window Maker’s documentation, featuring a Guided Tour to Window Maker’s features and an in-depth User Guide.
- FreeBSD’s User Handbook, detailing every element of the system, including a chapter on The X Window System.
- Vim Tips Wiki, a collection of tips and tutorials for the Vim text editor.
If you enjoy my blog or find it useful, please consider becoming a patron on Patreon to help me keep my site live and create more content!