Xmonad/Config archive/skorpan's xmonad.hs
-- -- ~/.xmonad/xmonad.hs --
-- import the necessary libraries
import XMonad import XMonad.ManageHook import XMonad.Operations import XMonad.Actions.CycleWS import XMonad.Actions.DwmPromote import XMonad.Actions.RotSlaves import XMonad.Actions.RotView import XMonad.Actions.SinkAll import XMonad.Hooks.DynamicLog ( PP(..), dynamicLogWithPP, dzenColor, wrap, defaultPP ) import XMonad.Hooks.UrgencyHook import XMonad.Layout.Grid import XMonad.Layout.Maximize import XMonad.Layout.NoBorders ( noBorders, smartBorders ) import XMonad.Layout.Tabbed import XMonad.Layout.ToggleLayouts import XMonad.Util.Run
import qualified XMonad.StackSet as W import qualified XMonad.Actions.FlexibleResize as Flex import qualified Data.Map as M import Data.Bits ((.|.)) import Data.Ratio import Graphics.X11 import System.IO
dmenuExec = "exe=`dmenu_path | dmenu -b -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*' -nb '#000000' -nf '#FFFFFF' -sb '#333333'` && eval \"exec $exe\"" myIconsDir = "/home/deniz/usr/share/dzen2/icons" myStatusBar = "dzen2 -bg '#222222' -fg '#777777' -h 16 -w 640 -sa c -e -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*' -ta l"
main = do din <- spawnPipe myStatusBar
xmonad $ defaultConfig { borderWidth = 2 , normalBorderColor = "#555555" , focusedBorderColor = "#dddddd" , workspaces = ["1:main", "2:web", "3:dev"] ++ map show [4..7] ++ ["8:warez","9:music"] , terminal = "urxvt" , modMask = mod4Mask , defaultGaps = [(16,0,0,0)] , manageHook = manageHook defaultConfig <+> myManageHook , logHook = dynamicLogWithPP $ myPP din , layoutHook = toggleLayouts (noBorders Full) $ smartBorders $ tiled ||| Mirror tiled ||| Full ||| Grid ||| tabbed shrinkText defaultTConf ||| maximize (Tall 1 (3%100) (1%2)) , keys = \c -> myKeys c `M.union` keys defaultConfig c , mouseBindings = \c -> myMouse c `M.union` mouseBindings defaultConfig c } where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 50%100 delta = 5%100
-- application control -- myManageHook :: ManageHook myManageHook = composeAll . concat $
[ [ className =? c --> doFloat | c <- myFloats] , [ title =? t --> doFloat | t <- myOtherFloats] , [ resource =? r --> doIgnore | r <- myIgnores] , [ className =? "Firefox-bin" --> doF (W.shift "2:web") ] ] where myIgnores = [] myFloats = ["feh", "GIMP", "gimp"] myOtherFloats = ["Bon Echo Preferences", "Mail/News Preferences", "Bon Echo - Restore Previous Session", "MPlayer"]
-- modify/add default key binds -- myKeys conf@(XConfig {modMask = modm}) = M.fromList $
[ ((modm, xK_p ), spawn dmenuExec) , ((modm, xK_x ), sendMessage ToggleLayout) , ((modm, xK_z ), toggleWS) , ((modm, xK_Left ), windows W.focusUp) , ((modm, xK_Right ), windows W.focusDown) , ((modm, xK_Up ), windows W.focusUp) , ((modm, xK_Down ), windows W.focusDown) , ((modm, xK_Return ), spawn $ XMonad.terminal conf) , ((modm .|. shiftMask, xK_Tab ), rotSlavesUp) , ((modm .|. shiftMask, xK_Right ), rotView True) , ((modm .|. shiftMask, xK_Left ), rotView False) ]
-- modify/add default mouse binds -- myMouse (XConfig {modMask = modm}) = M.fromList $
[ ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) , ((modm, button4), (\_ -> rotView True)) , ((modm, button5), (\_ -> rotView False)) ]
-- dynamiclog pretty printer for dzen -- ironic that this is "pretty printer" with such fugly code. myPP h = defaultPP
{ ppCurrent = wrap "^fg(#ffffff)^bg(#888888)^p(3)" "^p(2)^fg()^bg()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppVisible = wrap "^bg(grey30)^fg(grey75)^p(2)" "^p(2)^fg()^bg()" , ppHidden = wrap "^fg(#ffffff)^bg()^p(2)" "^p(3)^fg()^bg()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppHiddenNoWindows = id . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppSep = " ^fg(#ffffff)^r(2x2)^p(2)^fg() " , ppWsSep = " " , ppLayout = (\x -> case x of "Tall" -> " ^i(" ++ myIconsDir ++ "/tall.xbm) " "Mirror Tall" -> " ^i(" ++ myIconsDir ++ "/mtall.xbm) " "Full" -> " ^i(" ++ myIconsDir ++ "/full.xbm) " "Grid" -> " ^i(" ++ myIconsDir ++ "/grid.xbm) " "Tabbed" -> " ^i(" ++ myIconsDir ++ "/tabbed.xbm) " "Maximize Tall" -> " ^i(" ++ myIconsDir ++ "/maximize.xbm) " ) , ppTitle = dzenColor "white" "" , ppOutput = hPutStrLn h }