Personal tools

Xmonad/Config archive/Eric Mertens' xmonad.hs

From HaskellWiki

< Xmonad | Config archive
Revision as of 18:41, 6 November 2007 by Glguy (Talk | contribs)

Jump to: navigation, search
import XMonad
import XMonad.Actions.RotView ( rotView )
import XMonad.Config ( defaultConfig )
import XMonad.Core ( xmonad )
import XMonad.Hooks.DynamicLog
import XMonad.Layouts ( (|||), Full(..) )
import XMonad.Layout.LayoutHints ( layoutHints )
import XMonad.Layout.TilePrime ( TilePrime(TilePrime) )
import XMonad.Prompt
import XMonad.Prompt.Shell
 
import qualified Data.Map as Map
import Data.Ratio
import Graphics.X11
 
main = xmonad $ defaultConfig
                  { borderWidth        = 2
                  , normalBorderColor  = "#cccccc"
                  , focusedBorderColor = "#cd8b00"
                  , terminal           = "urxvtc"
                  , workspaces         = ["main","net","www"]
                                         ++ map show [4..9]
                  , defaultGaps        = [(18,0,0,0)]
                  , modMask            = mod4Mask
                  , logHook            = dynamicLogWithPP myPP
                  , mouseBindings      = myMouse `joinMap`
                                           mouseBindings defaultConfig
                  , keys               = myKeys `joinMap` keys defaultConfig
                  , layoutHook         = Layout
                                            $ TilePrime 1 (3%100) (1%2) False
                                          ||| TilePrime 1 (3%100) (1%2) True
                                          ||| layoutHints Full
                  }
 
joinMap m n c = m c `Map.union` n c
 
myKeys (XConfig {modMask = modm}) = Map.fromList $
  [ ((modm, xK_p), shellPrompt myPromptConfig)
  , ((0, 0x1008ff12), spawn "amixer -q set Front toggle")
  , ((0, 0x1008ff13), spawn "amixer -q set PCM 2dB+")
  , ((0, 0x1008ff11), spawn "amixer -q set PCM 2dB-")
  ]
 
myPromptConfig = defaultXPConfig
                   { position = Top
                   , promptBorderWidth = 0
                   }
 
myMouse (XConfig {XMonad.modMask = modMask}) = Map.fromList $
    [ ((modMask, button4), (\_ -> rotView True))
    , ((modMask, button5), (\_ -> rotView False))
    ]
 
myPP = defaultPP
         { ppCurrent  = dzenColor "white" "#222222" . pad
         , ppVisible  = dzenColor "black" "#999999" . pad
         , ppHidden   = dzenColor "black" "#cccccc" . pad
         , ppHiddenNoWindows = const ""
         , ppWsSep    = ""
         , ppSep      = ""
         , ppLayout   = dzenColor "black" "#cccccc" .
                        (\ x -> case x of
                                  "TilePrime Horizontal" ->
                                    " ^i(/home/emertens/images/tile_horz.xpm) "
                                  "TilePrime Vertical"   ->
                                    " ^i(/home/emertens/images/tile_vert.xpm) "
                                  "Hinted Full"          ->
                                    " ^i(/home/emertens/images/fullscreen.xpm) "
                                  _                      -> pad x
                        )
         , ppTitle    = (' ':) . escape
         }
  where
  escape = concatMap (\x -> if x == '^' then "^^" else [x])
  pad = wrap " " " "