Xmonad/Config archive/leedo's xmonad.hs

From HaskellWiki
Jump to navigation Jump to search

xmonad.hs

-- xmonad.hs
import XMonad
import XMonad.Operations
import XMonad.Layout
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Actions.NoBorders
import XMonad.Config
import XMonad.Hooks.DynamicLog
import XMonad.Util.Run

import System.IO
import qualified Data.Map as M
import Data.Ratio ((%))

statusBarCmd= "dzen2 -bg '#324c80' -fg '#adbadd' -e '' -ta l -w 400 -fn '-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*'"
rb_pause = "rhythmbox-client --no-start --play-pause"
rb_volup = "rhythmbox-client --no-start --volume-up"
rb_voldown = "rhythmbox-client --no-start --volume-down"

main = do din <- spawnPipe statusBarCmd
          xmonad $ defaultConfig
                     { borderWidth        = 2
                     , defaultGaps        = [(16,0,0,0)]
                     , modMask            = mod4Mask
                     , normalBorderColor  = "#cccccc"
                     , layoutHook         = resizetall ||| Mirror resizetall ||| noBorders Full
                     , focusedBorderColor = "#cd8b00"
                     , terminal           = "urxvt"
                     , logHook            = dynamicLogWithPP $ dzenPP
                                          { ppOutput = hPutStrLn din }
                     , keys = \c -> mykeys c `M.union` keys defaultConfig c
                     }
 where
     resizetall = ResizableTall 1 (3/100) (1/2) []
     mykeys (XConfig {modMask = modm}) = M.fromList $
             [ ((modm .|. shiftMask, xK_p), spawn rb_pause)
             , ((modm .|. shiftMask, xK_equal), spawn rb_volup)
             , ((modm .|. shiftMask, xK_minus), spawn rb_voldown)
             , ((modm, xK_z), sendMessage MirrorShrink)
             , ((modm, xK_a), sendMessage MirrorExpand)
             , ((modm, xK_g), withFocused toggleBorder) ]

.Xsession

xrandr -s 0
xrdb $HOME/.Xresources
xsetroot -cursor_name left_ptr
xsetroot -solid '#a9badd'

FG='#a9badd'
BG='#324c80'
$HOME/bin/xmonad-clock | dzen2 -e '' -x 400 -w 880 -ta r -fg $FG -bg $BG -fn '-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*' &

$HOME/bin/xmonad

wait $!
pkill -HUP dzen2
wait