This repo contains my computer configuration files! The code and configuration here is covered by the MIT license - see the text here.
Particularly highlighting stuff that may be interesting for others to use:
Logging and process running
Logging and process running is implemented by using rio package. To integrate nicely with rio, a couple monads are defined:
Xiomonad, which wraps the
IOmonad in the same reader context.
There are also process running utilities which log process start and end. In particular:
spawnfunction asynchronously spawns a process, similarly to the standard xmonad function of the same name.
syncSpawnfunction synchronously spawns a process. Its type is intentionally restricted to run in
syncSpawnAndReadfunction runs a process and reads its output.
Implements a couple utilities inspired by XMonad.Actions.SpawnOn -
spawnAndDo. These utilities record the spawned process ID and associate it with a
ManageHook. The configuration uses this to spawn applications on particular workspaces at startup.
If a sanity check of systemd-cat succeeds on startup, then it gets used to wrap the processes. This way the logs of all processes end up in the systemd log. One cool thing this allows is bringing up the logs for a particular window on request (currently bound to
These utilities rely on the
xmonad, described in a section below.
At startup, some standard stuff like a browser and emacs get run. The following also gets run:
redshift, a utility to adjust screen color temperature at night.
A terminal using systemd journalctl, on workspace
9, to display all error messages since boot. These errors get filtered by
env/errlog-filter/errlog-filter.hs- the goal being to investigate errors encountered and hide them once the conclusion is that they are benign. I don't yet have an exhaustive list of benign errors outputted by my computer.
A terminal using systemd journalctl, also on workspace
9, to display the most recent logs.
A terminal running
bluetoothctl, also on workspace
9, for cli control of bluetooth devices. Specifically, Bluetooth.hs has some utilities for connecting and disconnecting devices which have been paired. It uses
tmux send-keysto enter commands into the
bluetoothctlterminal. For some reason, non-interactive cli approaches to controlling bluetooth didn't work properly for me.
A terminal running
nmtui, also on workspace
9, for controlling internet connections, particularly wifi. I've found
nmtuito be more reliable than using GUI interfaces, and more convenient than using
Screen lock on startup and after sleep
Probably more effort than it was worth, but I liked the idea of the
startup applications starting up in parallel with the password
screen. To do this, I enabled gdm autologin, and immediately start
slock on start of
xmonad. See ScreenLock.hs.
I also wanted to require the password after resuming from
slock to be run before sleeping.
Other bits of code
Audio.hs has utilities for adjusting volume and toggling the microphone via use of
amixer. It also uses
notify-sendto report the state of the audio.
Brightness.hs has utilities for adjusting laptop screen brightness by writing to
/sys/class/backlight/intel_backlight/brightness(works for thinkpad screens). User access to this is enabled by copying
byzanz is a utility for capturing gif recordings of the screen. Byzanz.hs has code to run [env/byzanz-record-region.sh], a script using [xrectsel] and byzanz to record a region of the screen. The script also uses imagemagick to downscale the captured gif by a factor of 2 if
RedShift.hs has code for running redshift and allowing toggling it (by a rather crude mechanism - killing and starting).
Spotify.hs has utilities for dbus control of spotify - basic stuff like play / pause / next / previous.
TallWheel.hs is just like the built in xmonad
Touchpad.hs uses xinput to toggle the enabling / disabling of a thinkpad touchpad. The touchpad is initially disabled.
Prompt.hs provides prompts for running shell actions (
shellPrompt) or xmonad actions (
actionPromptis used for the xmonad actions that I use quite infrequently, and so shouldn't have keybindings.
No symlink manager, just git
This dotfiles repo uses git directly instead of having an install procedure or symlink manager. This has quite a few benefits:
Simplicity - no configuration needed.
It helps keep my home directory tidy, as new files and folders either get added to this repo, deleted, or added to
No need to research, compare and contrast symlink management approaches.
This might initially seem like a bad idea, since
git searches parent
.git repos, and so commands might inadvertantly apply to
the home dir repo. There's a pretty good solution to this, though it
requires a bit of setup. See
env/home-dir-git.md for more info on this.
The submodules referenced by this repo have a few non-standard patches applied. Some of these are in the form of PRs which will hopefully be merged, and some already have been merged.
This configuration uses a patched xmonad - the submodule is located
env/xmonad. At time of writing this readme, it has the following
XMonad by default installs a
SIGCHLDhandler which does nothing. The problem with this is that it means that the typical process functions don't work properly if you want to wait for process exit. Since I want to have proper process handling and logging,
SIGCHLDcan't get ignored. The comments in the code indicate that it was ignored to avoid zombie processes, but I haven't seen them accumulate. Even when zombies do occur, they are pretty benign. The patch
Omits implicit recompile on XMonad start. The patch
sendRestartfunction, which seems to be a much nicer way to handle restarting XMonad, as it doesn't require running another xmonad process just to send the signal. The patch
Exposes constructor for the
Xmonad, which allowed me to define
MonadCatchinstances for it. The patch
Uses a patched xmonad-contrib - the submodule is located at
env/xmonad-contrib. At time of writing this readme, it has the
A PR I wrote to make XMonad.Prompt more reliable on exceptions: xmonad-contrib#287
A change to XMonad.Prompt to make it ignore more keymasks. Some users of XMonad may need these keymasks, so it's not a change everyone might want. See discussion in xmonad-contrib#290.
Systemd version 242 and above includes my small patch to
systemd-cat, which allows using different log levels
for stdout and stderr. In particular, with my config,
err level and
stdout gets logged with
Most systems do not yet have this recent of a systemd version. It's
possible to only build the
systemd-cat and its deps, and it seems to
work fine atop near enough systemd versions. Here's how to build it:
sudo apt install meson sudo apt build-dep systemd meson build ninja -C build systemd-cat
Then, from within the repo I did
ln -s build/systemd-cat ~/.local/bin/systemd-cat to put it in my local bin. If just a copy
is done then it will complain about missing shared objects.
Ubuntu / debian dependencies
I typically use ubuntu / debian flavor. For convenience, I'm
apt install invocations that install dependencies of
Here are some development dependencies needed to build this XMonad configuration, some of the submodules, and some of the other programs it invokes:
sudo apt install libcairo2-dev libxinerama-dev libxdo-dev libxrandr-dev libgmp-dev libxext-dev libxss-dev libxft-dev libdbus-1-dev libgtk-3-dev
And a few programs that I use unmodified:
sudo apt install scrot feh byzanz
sudo apt-get install fonts-hack-otf fonts-hack-ttf
Log of setup notes - specific steps I've taken to setup my computer.
.profiledon't have anything particularly special. The main thing to note is that
~/env/untracked/settings.shif it exists. The purpose of this is to set
HIDPI, which in turn will cause some settings specific to using high pixel density displays.