HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Request an account if you don't have one.

Xmonad/Config archive/Wraithan's xmonad.hs

< Xmonad | Config archive

Categories: XMonad configuration

import XMonad hiding (Tall)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Layout.HintedTile
import XMonad.Layout.LayoutHints (layoutHints)
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run(spawnPipe)
 
import System.Exit
import System.IO
import Data.Monoid
 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
 
main = do
    xmproc <- spawnPipe "xmobar"
    xmonad $ defaultConfig {
        terminal           = "urxvt -fg white",
        modMask            = mod4Mask,
        workspaces         = ["1:Chat", "2:Web", "3:Code", "4:Terms", "5", "6", "7", "8", "9:Music"],
        normalBorderColor  = "#333333",
        focusedBorderColor = "#333399",
        manageHook         = composeAll [],
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
        layoutHook         = myLayout,
        logHook            = dynamicLogWithPP $ xmobarPP { 
                                 ppOutput = hPutStrLn xmproc,
                                 ppTitle = xmobarColor "green" "" . shorten 50
                             }
    }
 
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    [ ((modMask              , xK_Return   ), spawn $ XMonad.terminal conf)
    , ((modMask .|. shiftMask, xK_c        ), kill)
    , ((modMask              , xK_space    ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space    ), setLayout $ XMonad.layoutHook conf)
    , ((modMask              , xK_n        ), refresh)
    , ((modMask              , xK_Tab      ), windows W.focusDown)
    , ((modMask              , xK_j        ), windows W.focusDown)
    , ((modMask              , xK_k        ), windows W.focusUp)
    , ((modMask              , xK_m        ), windows W.focusMaster)
    , ((modMask .|. shiftMask, xK_Return   ), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j        ), windows W.swapDown)
    , ((modMask .|. shiftMask, xK_k        ), windows W.swapUp)
    , ((modMask              , xK_h        ), sendMessage Shrink)
    , ((modMask              , xK_l        ), sendMessage Expand)
    , ((modMask              , xK_t        ), withFocused $ windows . W.sink)
    , ((modMask              , xK_comma    ), sendMessage (IncMasterN 1))
    , ((modMask              , xK_period   ), sendMessage (IncMasterN (-1)))
    , ((modMask .|. shiftMask, xK_q        ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q        ), spawn "xmonad --recompile; xmonad --restart")
    , ((modMask              , xK_F2       ), shellPrompt defaultXPConfig)
    , ((0                    , 0x1008ff30  ), shellPrompt defaultXPConfig)
    , ((0                    , 0x1008ff13  ), spawn "amixer -q set Master 2dB+")
    , ((0                    , 0x1008ff11  ), spawn "amixer -q set Master 2dB-")
    , ((0                    , 0x1008ff12  ), spawn "amixer -q set Master toggle")
    , ((0                    , 0x1008ff16  ), spawn "cmus-remote --prev")
    , ((0                    , 0x1008ff17  ), spawn "cmus-remote --next")
    , ((0                    , 0x1008ff14  ), spawn "cmus-remote --pause")
    , ((0                    , 0x1008ff5b  ), spawn "urxvt -e screen -rd cmus")
    , ((modMask              , xK_Print    ), spawn "scrot -e 'mv $f ~/Screenshots'")
    ]
    ++
 
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
 
    ++
 
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
 
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w
                                          >> windows W.shiftMaster))
    , ((modMask, button2), (\w -> focus w >> windows W.shiftMaster))
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w
                                          >> windows W.shiftMaster))
    ]
 
myLayout = avoidStruts $ tiled ||| wideTiled ||| Full
  where
     tiled = HintedTile nmaster delta ratio Center Tall
     wideTiled = HintedTile nmaster delta ratio Center Wide
     nmaster = 1
     ratio   = 1/2
     delta   = 3/100

Retrieved from "http://haskell.cs.yale.edu/haskellwiki/Xmonad/Config_archive/Wraithan%27s_xmonad.hs"

This page has been accessed 431 times. This page was last modified 11:53, 31 July 2009. Recent content is available under a simple permissive license.