xmonad.hs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import System.IO
import Graphics.X11.ExtraTypes.XF86
import XMonad
import XMonad.Actions.SpawnOn
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run (spawnPipe)
import XMonad.Util.EZConfig (additionalKeys)

main = do
  xmproc <- spawnPipe ".cabal/bin/xmobar .xmonad/xmobarrc"
  xmonad $ def {
    terminal           = "gnome-terminal",
    normalBorderColor  = "#0000FF",
    focusedBorderColor = "#FF0000",
    borderWidth        = 2,
    modMask            = mod4Mask,
    layoutHook         = avoidStruts $ layoutHook def,
    manageHook         = manageDocks <+> manageHook def,
    logHook            = dynamicLogWithPP $ xmobarPP {
      ppOutput = hPutStrLn xmproc,
      ppTitle  = xmobarColor "green" "" . shorten 50
    },
    startupHook        = do
      spawnOn "3" "psensor"
  } `additionalKeys`
    [((0, xF86XK_AudioLowerVolume), spawn "amixer set Master 3%-"),
     ((0, xF86XK_AudioRaiseVolume), spawn "amixer set Master 3%+"),
     ((0, xF86XK_AudioMute), spawn "amixer set Master toggle; amixer set Headphone toggle; amixer set Speaker toggle")]