This is a tour of my FreeBSD laptop. I’ve set a goal of configuring a Unix laptop with focused and efficient user interface, suitable for all sorts of office work, research and entertainment tasks. My point of reference for this machine is the 13-inch Retina MacBook Pro 2015 and Jobs-era MacOS versions, on which my choices of user interface elements are mainly based.
This is a work in progress. I am not a programmer or a systems administrator, hence, this post is a user’s perspective which may be of interest to others considering FreeBSD or another open source OS for their daily desktop use and are coming from the Mac background. I will occasionally update this page with the latest information.
At the current moment this is a Lenovo ThinkPad X1 Yoga laptop with Intel Core i7-6600U 2.60 GHz CPU (Skylake), 8 GB RAM, 512 GB SSD, and Intel HD Graphics 520 integrated graphics adapter. It features a 14″ WQHD 2560 x 1440 touchscreen with Retina-like density of 210 dpi. In some ways this is similar to a 13-inch MacBook Pro, except that the tactile sensation is smooth plastic instead of aluminum, and it’s much lighter. ThinkPads are known to be one of the traditional choices of laptops among FreeBSD users, providing some degree of certainty in terms of driver support.
An external monitor (24″ Apple Cinema Display, 1920 x 1200 with a lower DPI) on my work place is occasionally connected via Mini DisplayPort to the ThinkPad. My custom script monitors connections and switches resolution, scaling and mouse sensitivity, from touchpad to a USB mouse and back, every 2 seconds. This emulates seamless transition between externally connected and internal display and input devices on a MacBook Pro.
System Environment and Command-Line Interface
My command-line interface shell of choice is the Z shell (zsh), which is an extended Bourne shell. It is not a principal choice – its place can be occupied by bash or other shells, which FreeBSD provides aplenty. Start-up daemons and other parameters are configured via the /etc/rc.conf configuration file, and daemons can also be managed from the command line using the service command, similarly to Mac’s launchctl. The laptop runs SSH, NTP and FTP daemons by default, as well as other auxiliary services.
FreeBSD features Linux binary compatibility layer (Linuxulator), so certain Linux utilities can be run without modifications. Windows executable compatibility is available via Wine, although not all applications work seamlessly. I’ve successfully debugged a Linux ELF executable using Windows version of IDA, and ran it then on FreeBSD without modifications.
Backups, System Migration and Upgrades
The whole UFS root file system is backed up every hour via rsync script, triggered by cron. The target backup host – the equivalent of Apple Time Capsule – is a Raspberry Pi with USB-connected hard drive. My custom script checks if an rsync process is already running before initiating hourly backup session, and it maintains a log of backups which is displayed every time I open a terminal. The whole system can be restored using rsync. It is possible to use ZFS snapshots and implement a better snapshot-based backup mechanism, providing virtually the same functionality as the Time Machine on a Mac.
Migrating the system to other hardware is possible. With rsync-based backups this would involve installing the same version of FreeBSD from the installation medium (usually a USB drive), which only takes a few minutes to get to the base installation with shell prompt, and then doing rsync to copy files over from the backup drive. The fact that FreeBSD draws a hard line between the base operating system and the user applications (installed and configured under /usr/local) simplifies management grealy. Rigid, conservative approach to the file system hierarchy is one of the reasons I enjoy FreeBSD.
Operating system upgrades are done via the freebsd-update command-line utility which is properly documented in the FreeBSD Handbook, included with the operating system. An upgrade of a major version of the operating system will trigger the necessity to upgrade all the binary packages installed. With approximately 1,200 packages this results in about 3 GB download, all done by a single pkg upgrade command. My general approach would be to wait for the second minor version revision until I do a major upgrade.
Graphical User Interface
The GUI on my FreeBSD laptop is Xfce4 with Compton, replicating MacOS experience as much as possible. I’ve modified the Enso 0.3 theme by rescaling graphical elements to 130% to match Retina-like resolution of the ThinkPad’s high-density screen. I’ve also recolored window buttons, as I prefer monochrome decorations more than tri-color.
The Xfce session is initiated with xcalib and a matching ICM file for proper color calibration. The X Windows server has been configured with disabled pixmap fonts, to ensure proper font rendition on web sites, and, also, to enable SNA acceleration on the graphics card and ThinkPad’s touchscreen functions via the evdev driver.
All application icons come from Macbuntu, available for download online, and the docker is Plank, running OSX Lion theme. Xfce’s Whisker menu is the equivalent of Mac’s application stack in the dock. The Whisker menu is launched by the Beastie icon that fits nicely to the right of the dock. Application search is available in the whisker menu itself. I’ve decided not to invest time trying to find a tool replicating Apple’s top menu. Next to the Beastie is the indicator of the file system mount points, and, also, the battery level indicator.
Keyboard window control, which is handled by Spectacle on a Mac, is now done by the Xfce window manager itself. No additional applications are required. For example, Ctrl+Alt+Left commands the window to occupy the right half of the screen, however, for Ctrl+Alt+Right I have a custom script that relies on wmctrl to snap the window to the right screen border, maximize vertically and resize it to fill 2/3 of the screen’s width. For Ctrl+Alt+C (center), another script centers the window, resizes it to 4/5 of screen and, also, maximizes it vertically. This allows to arrange windows quickly on screen for document and code comparison, filling forms, and other tasks. Ctrl+Alt+F (full-screen) maximizes the window.
Similarly to a Mac, Alt+Tab switches between applications quickly, however, I also employ skippy-xd for task switching in Expose-like manner. brightside is used for its activation via hot corners. I’ve had to modify skippy’s source code for it to work on dual monitors with different resolutions, however, I’ve submitted a comment to the author, so hopefully this will work in the next release.
The window file manager on the system is Thunar. It provides basic functionality of Finder, however, for file manipulation I prefer Double Commander, which is an excellent implementation of a dual-pane file manager I’ve got used to since PC/XT and the Norton Commander era. Albeit being in beta and still having a way to go to be rock-solid, Double Commander is really powerful stuff. I really enjoy the quick filter feature, as my working directory has more than 50,000 files, and I can simply type whatever I want to find and seep through the hierarchy to find that little file I forgot even how it was called. I made it look primitive deliberately by turning toolbars off, but there’s tons of stuff in it, and it’s very configurable.
Most of the applications I use on MacOS are available on FreeBSD. All applications are binary versions, installed via pkg from FreeBSD repository. Almost nothing is compiled from scratch. The only exception is the drm-stable-kmod – the driver for the laptop’s graphics card – which is easy to build and install from ports.
A number of third party applications replaces standard MacOS GUI utilities. Galculator replaces Mac’s desktop calculator widget which I use a lot for back-of-the-envelope stuff. I’ve found its paper mode, unavailable on Macs, to be quite useful, as it allows to track history.
Those apps are pretty much a drop-in replacements:
TextEdit: Mousepad Terminal: Xfce Terminal Activity Monitor: Xfce Task Manager MacOS Screenshots: Xfce4 Screenshot Unarchiver: Xarchiver Quicktime: VLC
Font Manager: Gnome Font Manager