Xmonad configuration

Xmonad is written in Haskell, minimalistic and powerfull window manager with a lot of hackable features, though its configuration could be tricky if it's your first experience with functional programming language.

No worries, it's not that hard, you can make simple configuration from arch.wiki in a minutes. For the better understanding you may want to read beginners tutorial.
For more detailed configuration with examples take a look at XMonad.Doc.Extending.
You also may want to use existing configurations from the community or mine below

img


Start with the installation:

yay -S xmonad xmonad-contrib

Xmonad has no status bar by default, so you'll need to pick by yourself.

Status bar (XMobar)

XMobar is a minimalistic, text based status bar.
You can find all the documentation in haskell.org/xmobar or on the github.

yay -S xmobar

Now you will need to configure it or use one of from the community or mine below img

Vim

Install vim latest version, if not installed.

yay -S vim

To use a theme, e.g. monokai, copy theme.vim file.

mkdir ~/.vim/colors && cd ~/.vim/colors
wget https://raw.githubusercontent.com/sickill/vim-monokai/master/colors/monokai.vim

After that you need to create .vimrc file and add following:

syntax enable
colorscheme monokai

If your terminal is transparent and you want to keep vim transparent as well, add this:

hi! Normal ctermbg=NONE guibg=NONE
hi! NonText ctermbg=NONE guibg=NONE

Terminal emulator

Termite to launch transparent terminal, used as a default terminal in xmonad.hs.
I use urxvt in xmonad.hs mostly to launch different applications e.g.: ranger or as a scrathpad terminal.
You can control both with a lot of useful vim keybindings.

yay -S termite rxvt-unicode terminology-git

zsh

Prezto looks much lightweight and faster solution than oh-my-zsh.
Install and run Zsh first:

yay -S zsh
zsh

Clone prezto repository:

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Create a new Zsh configuration by copying the zsh configuration files provided:

setopt EXTENDED_GLOB
  for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

Set Zsh as your default shell and open new window with zsh:

chsh -s /bin/zsh && exit

Prezto provides several themes you can choose:

prompt -l          # Check themes list
prompt -s nicoulaj # To preview a theme

Save the theme you like in ~/.zpreztorc

Console utilities

Tree is useful when you need to see a tree of folder structure in your terminal.
Fuck helps you auto-correct word "suod" -> "sudo".
Tmux is a famous terminal multiplexer.

yay -S tree fuck tmux

Program Launcher

Rofi is a part of my everyday environment, and good replacement for dmenu. You may want to know how to use Rofi with keybindings.
img

yay -S rofi
rofi -combi-modi drun,ssh -font "hack 12" -show combi -theme solarized # -theme onemon

You can bind it with Xmonad.modMask. I bound it near my point finger because of often usage xK_d (xK_h on qwerty layout):

((modm, xK_d), spawn "rofi -combi-modi drun,ssh -theme onedark -font 'hack 12' -show combi")

File manager

Ranger is my main file manager. It has vim-like keybindings, simple and powerfull.
You can find my global color config in .Xresources and .conf file in .dotfiles/.config/ranger.

yay -S ranger-git

To add video preview follow git wiki.

yay -S ffmpegthumbnailer

img

TIP

You can edit it in xmonad.hs and launch through scrathpad(urxvt -e ranger) with modm + r keybindings.

TIP

type ? to see all keybindings

To copy the default ranger configurations launch the command:

ranger --copy-config=all

where

rc.conf - startup commands and keybindings, eg you can set preview_images true commands.py - commands which are launched with : rifle.conf - applications used when a given type of file is launched.

For more tips and tricks see wiki.
To add video preview read github wiki.

Notification manager

Dunst is a simple and configurable notification manager.
There is no need to start or enable dunst; it is called by systemd when programs send notifications through dbus.

yay -S dunst
notify-send testTitle 'My Test Message'

TIP

DISPLAY and XAUTHORITY In case dunst not autostarted add this to your .xprofile:

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

Wallpaper

feh is a simple bg solution.

yay -S feh
feh --bg-scale /path/to/image.file

After this .fehbg will be created. So you can modify it however you want. As an example how to make random backgrounds:

feh --randomize --bg-fill ~/.wallpaper/*

WARNING

Instead of .xinitrc you can launch it in ~/.xmonad/xmonad.hs like this:

myStartupHook :: X()
myStartupHook = do
    spawn "$HOME/.fehbg"

PolicyKit

Polkit is also necessary for power management, notifications, NetworkManager permissions, et.c. as an unprivileged user.
Desktop environments already includes polkit, Xmonad don't, so you will need to install and run it. You can use any existing polkit agent.

yay -S polkit polkit-kde-agent 

And add following to the .xinitrc or .xprofile just before you execute xmonad:

/usr/lib/polkit-kde-authentication-agent-1 &

Read more about polkit at freedesktop.org.

Last Updated: 12/30/2018, 10:56:45 PM