2018-10-29

minimalistic gnu/linux system setup example

graphical user interface

the tiled window manager dwm handles the arrangement of xserver windows. desktop-example.png

little "clock" in the top right corner that shows the day of the year, the day of the week and the current daytime in utc+0 kiloseconds. it is set with xsetroot -name "content"

terminal

st started with a screen session. st -e screen. with the screen functionality, ctrl+c creates new terminal buffers, ctrl+a n and ctrl+a n switch between them. using this, a terminal emulator that supports tabs is not necessary. font: "Gohu GohuFont:pixelsize=14:antialias=false"

starting programs

xbindkeys to bind the most important commands to f keys. for example f1 is the web browser, f2 the file manager, f3 the terminal. f5 opens dmenu, a line appearing at the top of the screen to enter a program name to be run

~/.xbindkeysrc.scm

(xbindkey (quote (F1)) "firefox")
(xbindkey (quote (F2)) "thunar")
(xbindkey (quote (F3)) "st -e screen")
(xbindkey (quote (F5)) "dmenu_run")
(xbindkey (quote (F9)) "screenshot")

other programs are started using dmenu_run on f5

workflow

  • f keys to start programs directly or f5 to enter a command
  • f3 to open new terminals
  • f2 to open new file manager windows
  • f1 to open the browser
  • super key combinations or mouse clicks onto the dwm bar to switch between multiple desktops

keyboard layout adjustments

xmodmap to make the right shift-key work as the meta key for emacs and to disable the shift-lock key

~/.xmodmap

remove Lock = Caps_Lock
keysym Caps_Lock = Super_L
remove shift = Shift_R
add mod1 = Caps_Lock Shift_R
remove mod1 = Alt_L Alt_R
! add control = Alt_L Alt_R

a custom x11 keyboard-layout for the qgmlwb layout is used and a dead-key (a key that only modifies a subsequent key) for diaresis is on the circumflex key

login

boot goes to the tty console login with disabled cursor blinking (how to turn that off, there is an aur package for that) and at login a luks container for /home or /home/.{username} is decrypted and mounted to /home/{username} with the use of pam_mount. then ~/.bash_profile starts the xserver

~/.bash_profile

if [ "$(tty)" == /dev/tty1 ]
then
  exec startx
fi

~/.xinitrc

xmodmap /home/nonroot/.xmodmap
emacs --daemon
xbindkeys
compton -bCG --backend glx --vsync opengl-mswc
hsetroot -solid "#000000"
dwm

compton to fix screen tearing i otherwise get with 4k 60fps video playback. hsetroot sets the background. emacs is started in daemon mode so the slow startup happens only once and buffers are opened fast with emacsclient -tc which is in $EDITOR and there is a shell script named e

#!/bin/sh
# pass all arguments to the editor program configured with the $EDITOR environment variable

$EDITOR "$@"

users

especially on single user systems i use a generic nonroot user. saves having to invent names, memorise them, rename them or keep them up to date on different systems

linux distribution

archlinux because among other reasons

  • it follows upstream standards. not like debian, which makes extensive changes to upstream packages to make them debian specific and require debian dependent knowledge
  • comes installed with the minimum
  • always get the current version of packages, that went through a public testing phase in a testing repository. avoids having to manually compile things because you need a version that is already six months old and not in the repositories for your distribution version that will not be updated. also avoids risky distro upgrades, they just do not exist because the system updates gradually with each package update. manual intervention is rarely required, and if then only on important big changes like the switch to systemd or demanded by upstream developers of the used software
  • the package manager is a relief, in comparison to apt-get/apt-cache/dpkg. finally an efficient to use program that is fast and gives terse and clear output. packages are very easy to create, the only thing needed is basically a bash script that does the compile and installation steps. users can upload packages to the separate arch user repository. official packages are signed
  • on one workstation i have been running the same arch system for 8 years, which started as a 32bit system and was in-place converted to 64bit. arch can also be in-place converted into parabola linux, which is fsf endorsed

versioned system configuration

stored in a git repository with a file structure like this

data
  {hostname} ...
    {root-relative-full-paths}

symlinked to target destinations with "cp -rst / $PWD/data/hostname/*"

shell configuration

a simple prompt on its own line in magenta color that includes the basename of the current working directory

~
  echo test
test
~
  cd /usr/bin
bin
  ls guile
guile
bin

virtual machines

qemu is free software and does not need additional kernel version dependent modules like virtualbox. such modules need to be recompiled for each kernel update, which happen every few weeks, and if a compatible version is not yet available then you are out of luck and would not be able update the kernel. the qemu instance is set up to offer a vnc interface, which also works at boot time. "remmina" is then used to connect to the virtual machines. network bridging and external hardware can be more difficult to set up, but less so in newer versions

gtk style

~/.config/gtk-3.0/settings.ini

[Settings]
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=HighContrast
gtk-font-name=Sans 12
gtk-cursor-theme-size=0
gtk-cursor-blink=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_MENU
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=0
gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=0
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-color-scheme=tooltip_fg_color:#000\nbase_color:#525252\nselected_fg_color:#fff\ntext_color:#ffffff\nbg_color:#5C5C5C\ntooltip_bg_color:#a3bdd8\nselected_bg_color:#5e6a79\nfg_color:#FFFFFF\n
gtk-cursor-theme-name=Adwaita

~/.gtkrc-2.0

include "/home/nonroot/.gtkrc-2.0.mine"
gtk-theme-name="Adwaita-dark"
gtk-icon-theme-name="HighContrast"
gtk-font-name="Sans 12"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_MENU
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=0
gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=0
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"
gtk-xft-rgba="rgb"