# My Linux Desktop

## October 26, 2017 by Richard DW Redcroft

If you’ve read my previous posts you’ll know I’m currently using a lightweight Void Linux install, although my desktop isn’t Void specific. I use an Ubuntu LTS system at work but its a minimal server install to which I’ve installed a minimal Xorg and similar setup to my home system.

Let me start by saying that i don’t dislike the mouse, but my desktop is geared towards avoiding it as much as possible. This is because i vastly prefer the Tiling window manager paradigm, but also that i have trackpads. For years my WM of choice has been i3wm, and i still continue to use this at work. It is a solid window manager with lots of control and good out of the box default settings. However I’ve grown a little bored of i3 and i also find it a little bloated for my needs to which I’ve been pointlessly trying to eek out as much performance from my netbook as much as possible. I’ve been swapping window managers now for about 2 weeks, and while i really liked bspwm for its simplicity i have settled upon dwm.

dwm is a tiling window manager from the folks over at suckless.Their approach and philosophy towards software is something i agree with (even though I’m not a programmer, if i were then maybe i would disagree). I like the principle of simple statically compiled software that are simple and sleek. I have been an st terminal user for years now, and now I’m using dwm. When i first started using a tiling wm, i wanted more control that i needed. I wanted to be able to move and control everything manually, but the more i use tiling wm i realise i tend to use my wm in 2 basic modes, tabbed and partial split. By this i mean that most of the time all my windows are using the full screen space, with other windows tabbed in the same workspace, or on another workspace. I then have some windows split side by side, but beyond that i very rarely do a multi-split. I used to use multiple terminals side by side and on multiple desktops. Now i rely on a single st terminal session running tmux inside my window managers scratchpad.

The scratchpad is what kept me on i3 for so long, and is a feature i cant live without. Its a virtual space you can hide a floating window that can be show and hidden with a keystroke. Unlike a drop-down terminal this window can be resized and place anywhere which is useful if i want to read information from a web page or document. With the window managers i tried that didn’t have native scratchpad support i used a tdrop terminal instance. dwm provides a patch for adding scratchpad support. While not as feature-full as i3wm’s scratchpad it does everything i want.

### Compiling dwm and st

This is not recommended!. I build both dwm and st from source using the traditional software method. You should use your distros method of package management, such as ABS/PKGBUILD for Arch and xbps-src for Void. Void has a really nice workflow and i do use xbps-src for other packages, but with suckless tools i prefer to do this manually. Xbps-src makes this easy with suckless tools, just clone the repo then

vim srcpkgs/st/files/config.h

and edit the config file to your liking. The same goes for dwm. I believe patching is a simple as creating a patch directory and adding your patch

mkdir srcpkgs/st/patches/
cp patch srcpkgs/st/patches/

add patch_args=“-p1” to the template file srcpkgs/st/template

then compile as normal (only run binary bootstrap the first time you do an xbps-src install)

./xbps-src binary-bootstrap
./xbps-src pkg st
xbps-install --repository=hostdir/binpkgs -f st

### The old-school way

Even though xbps-src is a nice clean method, i still prefer to manually package dwm, st and dmenu as its a workflow i use across all of my systems and its the way I’ve been doing it for a while. First create a working directory

mkdir ~/.git
cd ~/.git

then clone the repo’s

git clone https://git.suckless.org/dwm
git clone https://git.suckless.org/st
git clone https://git.suckless.org/dmenu

from here you can customise with patches and config.h tweaks, but i usually compile a basic version first to make sure my system is working. First we need to install the devel utils

xbps-install -Su base-devel pkg-config
make
sudo make install

### Testing dwm

provided there are no errors you should be able to use st/dwm/dmenu. Test to make sure they work, then we’ll customise our packages.

cat /etc/X11/xinit/xinitrc | head -n -5 > ~/.xinitrc
echo "exec dwm" >> ~/.xinitrc
startx

If all goes well you should be in dwm! If you want to quit the default shortcut is Alt+Shift+Q

### Tweaking dwm

mv ~/Downloads/dwm*.diff ~/.git/dwm/
cd ~/.git/dwm/
patch -p1 < dwm-patch...diff

Some patches might conflict, and patch order might make a difference so YMMV. We can then edit our config.h to our liking.

vim config.h

The appearance parameters are at the top, such as borderpx, topbar, colours etc. Here are the notable values i have changed

static const unsigned int borderpx    = 3
static const char *fonts[]            = { "Terminus:size=8" };
static const char dmenufont           = "Terminus:size=8";
static const char col_red[]           = "#f22c4"; #replaced all instanced of col_cyan with col_red
...
...
{ "Emacs",    NULL,    NULL,    1 << 8,    0,    -1},
...
...
static const char *editcmd[] = { "emacs", NULL };
static const char *webcmd[] = { "firefox", NULL };
...
{ MODKEY|ShiftMask,     XK_d,    spawn,   {.v = editcmd} },
{ MODKEY|ShiftMask,     XK_w,    spawn,   {.v = webcmd} },
{ MODKEY,               XF_minus,togglescratch, {.v = scratchpadcmd }},

A copy of my config is on my github for both dwm and st are available to see my exact config.

Once you’ve configured your settings you need to compile and install. I create a simple script to do this for me

vim make.sh
#!/bin/bash
export CFLAGS="-march=native -Os -pipe"
make PREFIX=/usr
sudo make install PREFIX=/usr
chmod +x make.sh
./make.sh

### st colours

The one thing i do fairly frequently is change my terminal colours, usually to a different base16 config, sometimes a manual config. I use the base16-builder-python script to generate an easy to use st config.

mkdir ~/.base16/
cd ~/.base16/
pybase16 update
pybase16 build

This should generate base16 colorschemes for a range of applications, including st

now open the colourscheme we want,

cat output/st/build/base16-monokai-theme.h

transplant those values into our config.h, and then compile our st.

./make.sh

Run st to see if its to our liking. Congratulations! You now have a lightweight desktop with dwm, st and dmenu! Pressing Windows+- should show an st instance, to which we can run tmux and all our terminal applications. Pressing Windows+W will launch a firefox instance, and should you have it installed and configured, Windows+Shift+D should launch emacs on the 9th workspace. Pressing Windows+9 will take us to the 9th workspace, with numbers 1-8 taking us to their respective workspace. I won’t explain how tiling managers work too much in this post, i might make a video about it at some point.

If you’re new to this new mouse-less world you might still have allegiances with some gui applications, most notably a file-manager, text editor, music player, file archiver, email client etc here’s my suggestions for some of those

However all of these can be replaced with the terminal and ncurses applications, ie tar -xvf archive.tar.gzip or unzip archive.zip to extract files, tar -cvf archive.tar.xz files folders/ to compress files, cd mv cp ls commands instead of a file browser, mpd/ncmpcpp for playing music, or mopidy/ncmpcpp to play streaming music, vim as a basic text editor or emacs for a full blown os.

I also tend to use firefox and gmail as my email client because that’s just easier. I also don’t have a problem with google or google products/services. However Emacs+gnus/mu4e works well, along with isync+mutt/neomutt

Well that’s another long chunk of text, hopefully some of it was useful.