xmonad-config

February 13, 2018 ยท View on GitHub

xmonad-config is the xmonad configuration used by Vic Fryzel.

Introduction

If you are unfamiliar with xmonad, it is a tiling window manager that is notoriously minimal, stable, beautiful, and featureful. If you find yourself spending a lot of time organizing or managing windows, you may consider trying xmonad.

However, xmonad can be somewhat difficult to configure if you're new to Haskell or even to xmonad itself.

This project contains a completely working and very usable xmonad configuration "out of the box". If you are just starting out with xmonad, this will give you a configuration that I personally use for around 12 hours every day. Thought has been put into the colors, key bindings, layouts, and supplementary scripts to make life easier.

This project is also recommended for advanced xmonad users, who may just not want to reinvent the wheel. All source provided with this project is well documented and simple to customize.

Screenshot of xmonad-config For source code, or to contribute, see the xmonad-config project page.

Requirements

Installing requirements on Arch Linux

sudo pacman -S xmonad xmonad-contrib xmobar stalonetray dmenu scrot \
    cabal-install xcompmgr
sudo cabal update
cabal install --global yeganesh

Also install the consolekit-git package from the AUR. The process for doing this is documented here.

Installing requirements on Ubuntu Linux or Debian Linux

sudo aptitude install xmonad libghc-xmonad-contrib-dev xmobar stalonetray \
    suckless-tools scrot cabal-install xcompmgr consolekit
sudo cabal update
sudo cabal install --global yeganesh

Installation

Installing xmonad-config is a matter of backing up any xmonad configuration you may already have, cloning the git repository, and updating your PATH.

cd
mv .xmonad .xmonad.orig
git clone https://github.com/vicfryzel/xmonad-config.git .xmonad

Once xmonad-config is installed, you also need to ensure you can actually start xmonad. The mechanism to do this varies based on each environment, but here are some instructions for some common login managers.

Starting xmonad from lightdm, xdm, kdm, or gdm

Note: You may need to choose "Custom xsession" or similar at the login screen.

ln -s ~/.xmonad/xmonad-session-rc ~/.xsession
# Logout, login from lightdm/xdm/kdm/gdm

Starting xmonad from slim

ln -s ~/.xmonad/xmonad-session-rc ~/.xinitrc
# Logout, login from slim

Keyboard shortcuts

After starting xmonad, use the following keyboard shortcuts to function in your new window manager. I recommend you print these out so that you don't get stranded once you logout and back in.

Key BindingAction
Alt+Shift+ReturnStart a terminal
Alt+Ctrl+lLock screen
Alt+pStart dmenu. Once it comes up, type the name of a program and enter
Alt+Shift+pTake screenshot in select mode. Click or click and drag to select
Alt+Ctrl+Shift+pTake fullscreen screenshot. Supports multiple monitors
Alt+Shift+cClose focused window
Alt+SpaceChange workspace layout
Alt+Shift+SpaceChange back to default workspace layout
Alt+nResize viewed windows to the correct size
Alt+TabFocus next window
Alt+jFocus next window
Alt+kFocus previous window
Alt+mFocus master window
Alt+ReturnSwap focused window with master window
Alt+Shift+jSwap focused window with next window
Alt+Shift+kSwap focused window with previous window
Alt+hShrink master window area
Alt+lExpand master window area
Alt+tPush floating window back into tiling
Alt+,Increment number of windows in master window area
Alt+.Decrement number of windows in master window area
Alt+qRestart xmonad. This reloads xmonad configuration, does not logout
Alt+Shift+qQuit xmonad and logout
Alt+[1-9]Switch to workspace 1-9, depending on which number was pressed
Alt+Shift+[1-9]Send focused window to workspace 1-9
Alt+wFocus left-most monitor (Xinerama screen 1)
Alt+eFocus center-most monitor (Xinerama screen 2)
Alt+rFocus right-most monitor (Xinerama screen 3)
Alt+Shift+wSend focused window to workspace on left-most monitor
Alt+Shift+eSend focused window to workspace on center-most monitor
Alt+Shift+rSend focused window to workspace on right-most monitor
Alt+Left Mouse DragDrag focused window out of tiling
Alt+Right Mouse DragResize focused window, bring out of tiling if needed
Alt+Right Mouse DragResize focused window, bring out of tiling if needed

Personalizing or modifying xmonad-config

Once cloned, xmonad-config is laid out as follows.

All xmonad configuration is in ~/.xmonad/xmonad.hs. This includes things like key bindings, colors, layouts, etc. You may need to have some basic understanding of Haskell in order to modify this file, but most people have no problems.

All other configuration files are in ~/.xmonad.

All scripts are in ~/.xmonad/bin/. Scripts are provided to do things like take screenshots, start dmenu, or fix your multi-head layout after a fullscreen application may have turned off one of the screens.

Colors set in the xmobar config and dmenu script are meant to coincide with the IR_Black terminal and vim themes.

Configuring xmobar and stalonetray for your displays

xmonad-config is pre-configured to work on one of two display setups.

  1. Single 4K (3840x2160) resolution display.
  2. Dual 2560x1440 displays, with the right display as the primary.

If your display setup is different, you need to edit the xmobar and stalonetray configurations provided, probably just to adjust the geometry of the bars for your resolution. An example would be if you're using xmonad-config on a laptop with a lower resolution screen. In this example, you'd simply need to edit the geometries in xmobar-single.hs and stalonetrayrc-single.

When you first clone xmonad-config, it is setup to use the single display configuration files.

To switch between the single and dual display setups, you must edit xmonad-session-rc and xmonad.hs to point to the appropriate config files.

In xmonad-session-rc change the stalonetray line to read:

stalonetray -c ~/.xmonad/stalonetrayrc-dual

In xmonad.hs change the myXmobarrc line to read:

 myXmobarrc = "~/.xmonad/xmobar-dual.hs"

To update geometries, edit xmobar-single.hs and stalonetrayrc-single, or edit xmobar-dual.hs and stalonetrayrc-dual.