From Clean & Green Mockup to OpenBSD cwm(1) desktop

       604 words, 3 minutes

If the words CGA or Hercules raise sweet memories from your far away youth, the Mockup Clean & Green from u/awareofdistractions may hit you right in the heart. And if you like it so much, it may be used for real-life desktop environment using OpenBSD stock and ports material.

Desktop and Window manager

Configure your .xsession file to paint the desktop grey and start cwm(1).

# vi ~/.xsession
(...)
xsetroot -solid '#4C566A'
polybar -c ~/.config/polybar/mockup top &
exec cwm

Configure your .cwmrc file so that it goes green & grey.

# vi ~/.cwmrc
(...)
ignore polybar
(...)
borderwidth 3
gap 50 0 0 0 
snapdist 20 
fontname "Iosevka NF:size=12"
color activeborder "#50FA7B"
color inactiveborder "#21222C"
color menubg "#282A36"
color menufg "#50FA7B"
color font "#F8F8F2"
color selfont "#282A36"

Grab the Iosevka Term font in Nerd Fonts edition.

# ftp -o "~/.fonts/Iosevka-Medium-Complete-Mono.ttf" \
  'https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Iosevka/Medium/complete/Iosevka%20Term%20Medium%20Nerd%20Font%20Complete%20Mono.ttf?raw=true'

Status bar

Install polybar from ports. Then configure it to display the various informations in the right colors.

# pkg_add polybar
# mkdir -p ~/.config/polybar
# vi ~/.config/polybar/mockup
[colors] 
bg = #2E3440 
fg = #FFFFFF 
green = #50FA7B 

[settings] 
screenchange-reload = true 

[bar/top] 
width = 1900 
height = 40 
offset-x = 10 
offset-y = 10 

fixed-center = false 

background = ${colors.bg} 
foreground = ${colors.fg} 

padding-left = 0 
padding-right = 2 

module-margin-left = 1 
module-margin-right = 1 

font-0 = Iosevka NF:style=Medium:size=12;3

modules-left = xworkspaces xwindow 
modules-right = sensor network volume kbdlayout battery datetime 

[module/battery] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh battery 
interval = 10 

[module/datetime] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh datetime 
interval = 10 

[module/kbdlayout] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh kbdlayout 
interval = 10 

[module/network] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh network 
interval = 2 

[module/sensor] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh sensor
interval = 2 

[module/volume] 
type = custom/script 
exec = $HOME/scripts/polybar-modules.sh volume 
interval = 10 

[module/xworkspaces] 
type = internal/xworkspaces 
icon-0 = nogroup; 
icon-1 = one;1 
icon-2 = two;2 
icon-3 = three;3 
icon-4 = four;4 
icon-5 = five;5 
icon-6 = six;6 
icon-7 = seven;7 
icon-8 = eight;8 
icon-9 = nine;9 

label-active = %icon% 
label-active-foreground = ${colors.bg} 
label-active-background = ${colors.green}
label-active-padding = 2 

label-urgent = %icon% 
label-urgent-padding = 2 

label-empty = %icon% 
label-empty-padding = 2 

[module/xwindow] 
type = internal/xwindow 
format = <label> 
label =  %title:0:60:...% 
label-empty =

X terminal and text file manager

xterm(1) is tweaked using ~/.Xdefaults and the text file manager nnn(1) can be installed from ports and configured using environment variables.

# vi ~/.Xdefaults
(...)
XTerm*faceName:  Iosevka NF:style=Regular:size=12
XTerm*faceSize1: 8 
XTerm*faceSize2: 10 
XTerm*faceSize3: 14 
XTerm*faceSize4: 16 
XTerm*faceSize5: 20 
XTerm*faceSize6: 24
(...)
*.background:    #2E3440
*.foreground:    #FFFFFF
*.color2:        #50FA7B
*.color10:       #50FA7B

# doas pkg_add nnn
# echo NNN_COLORS='2222' >> ~/.kshrc
# echo NNN_FCOLORS='0f0f020f0f0f0f0f0f0f0f0f' >> ~/.kshrc

Final look

With that all done, you may restart your X session and get that pretty (to me) look for the OpenBSD desktop.

To be honest, my real configuration is a bit different. I mixed colors from that Mockup with the full Dracula colorscheme and the Blue color from Arc-Darker GTK theme. Furthermore, I’d rather use fonts from Apple and CodeNewRoman NF. And I also added a bit of transparency to polybar and shadow effects.

And that’s all for now. Happy coloring!

[ Added on 2021-02-25 ] In my real actual conf, polybar is started from .xsession using this starting script . The rendering of the right-hand side information is done using that polybar-modules script. You shall modify the latter a bit if you only use a single font and/or if you don’t use “SF Pro Display” and “CodeNewRoman NF”. Both scripts are provided for learning purpose. Don’t held me responsible if you use them on your computer and the whole Universe collapses !-)