-- Imports {{{ -- A lot of imports. Actually, I don't know which of them are truely useful import XMonad -- Layouts import XMonad.Layout import XMonad.Layout.NoBorders import XMonad.Layout.PerWorkspace import XMonad.Layout.LayoutHints import XMonad.Layout.ThreeColumns import XMonad.Layout.ToggleLayouts -- Hooks import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageDocks import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.DynamicLog (PP(..), dynamicLogWithPP, wrap, defaultPP) import XMonad.Hooks.UrgencyHook -- Actions import XMonad.Actions.CycleWS import XMonad.Actions.CycleRecentWS import XMonad.Actions.CopyWindow import XMonad.Actions.DwmPromote import XMonad.Actions.GridSelect import XMonad.Actions.MouseResize import XMonad.Actions.OnScreen import XMonad.Actions.SinkAll import XMonad.Actions.WindowGo import XMonad.Util.Run (spawnPipe) import qualified XMonad.StackSet as W import qualified Data.Map as M import Data.Bits ((.|.)) import System.IO (hPutStrLn) -- }}} -- Control Center {{{ -- Colour scheme {{{ myNormalBGColor = "#2e3436" myFocusedBGColor = "#414141" myNormalFGColor = "#babdb6" myFontColor = "#73d216" myFocusedFGColor = "#73d216" myUrgentFGColor = "#f57900" myUrgentBGColor = myNormalBGColor mySeperatorColor = "#2e3436" -- }}} -- Icon packs can be found here: -- http://robm.selfip.net/wiki.sh/-main/DzenIconPacks myBitmapsDir = "/home/luc/.share/icons/dzen" myFont = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-iso10646-1" -- }}} -- Workspaces {{{ myWorkspaces :: [WorkspaceId] myWorkspaces = map show [1..9 :: Int] -- }}} -- Define Modifier key -- mod1Mask : Alt, mod4Mask : Super -- myModMask = mod1Mask myModMask = mod4Mask -- Define terminal myTerminal = "urxvt -pe tabbed" -- Define borderwidth myBorderWidth = 1 -- Keybindings {{{ myKeys conf@(XConfig {modMask = modm}) = M.fromList $ [ ((modm , xK_p), spawn ("exec `dmenu_path | dmenu -fn '" ++ myFont ++ "' -nb '" ++ myNormalBGColor ++ "' -nf '" ++ myNormalFGColor ++ "' -sb '" ++ myFocusedBGColor ++ "' -sf '" ++ myFontColor ++ "'`")) , ((modm , xK_i), spawn ("exec iceweasel")) , ((modm , xK_f), sendMessage ToggleStruts >> sendMessage ToggleLayout) , ((modm , xK_n), spawn ("liferea")) , ((modm , xK_m), spawn ("icedove")) , ((0 , 0x1008ff59), spawn ("xrandr --auto")) , ((0 , 0x1008ff11), spawn ("amixer -q set Master 1- unmute")) , ((0 , 0x1008ff13), spawn ("amixer -q set Master 1+ unmute")) , ((0 , 0x1008ff12), spawn ("amixer -c 0 set Master toggle")) ] ++ -- Remap switching workspaces to M-[&é"'(-è_ç] -- I get these codes with xev. With this codes, I'm sure to get the key I want [((m .|. modm, k), windows $ f i) | (i, k) <- zip (XMonad.workspaces conf) [0x26,0xe9,0x22,0x27,0x28,0x2d,0xe8,0x5f,0xe7] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] -- }}} statusBarCmd= "dzen2 -p -h 16 -ta l -bg '" ++ myNormalBGColor ++ "' -fg '" ++ myNormalFGColor ++ "' -w 300 -sa c -fn '" ++ myFont ++ "'" -- Main {{{ main = do statusBarPipe <- spawnPipe statusBarCmd xmonad $ withUrgencyHook dzenUrgencyHook { args = ["-bg", "darkgreen", "-xs", "1"] } $ defaultConfig { modMask = myModMask , borderWidth = myBorderWidth , terminal = myTerminal , normalBorderColor = myNormalBGColor , focusedBorderColor = myFocusedFGColor , manageHook = manageHook defaultConfig <+> myManageHook , layoutHook = smartBorders $ avoidStruts $ toggleLayouts Full $ layoutHook defaultConfig , workspaces = myWorkspaces , logHook = dynamicLogWithPP $ myPP statusBarPipe , keys = \c -> myKeys c `M.union` keys defaultConfig c } -- }}} -- Window rules (floating, tagging, etc) {{{ myManageHook = composeAll . concat $ [ -- The applications that go to Workspace 1 -- [ className =? b --> doF (W.shift "1") | b <- myClassWebShifts] -- The applications that float [ className =? i --> doFloat | i <- myClassFloats] -- The applications to ignore , [ className =? j --> doIgnore | j <- myClassIgnore] , [ title =? k --> doIgnore | k <- myTitleIgnore] ] where -- The applications that go to Workspace 1 -- myClassWebShifts = ["Iceweasel", "Liferea"] myClassFloats = ["Mplayer", "Gimp"] myClassIgnore = ["stalonetray", "trayer"] myTitleIgnore = ["xfce4-notifyd"] -- }}} -- Dzen Pretty Printer {{{ -- Stolen from Rob [1] and modified -- [1] http://haskell.org/haskellwiki/Xmonad/Config_archive/Robert_Manea%27s_xmonad.hs myPP handle = defaultPP { ppCurrent = wrap ("^fg(" ++ myFontColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p(4)") "^p(4)^fg()^bg()", ppUrgent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myUrgentBGColor ++ ")^p(4)") "^p(4)^fg()^bg()", ppVisible = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p(4)") "^p(4)^fg()^bg()", ppSep = "^fg(" ++ mySeperatorColor ++ ")^r(3x3)^fg()", ppLayout = (\x -> case x of "Tall" -> " ^i(" ++ myBitmapsDir ++ "/tall.xbm) " "Mirror Tall" -> " ^i(" ++ myBitmapsDir ++ "/mtall.xbm) " "Full" -> " ^i(" ++ myBitmapsDir ++ "/full.xbm) " "ThreeCol" -> " ^i(" ++ myBitmapsDir ++ "/threecol.xbm) " "Hinted Tall" -> " ^i(" ++ myBitmapsDir ++ "/tall.xbm) " "Hinted Mirror Tall" -> " ^i(" ++ myBitmapsDir ++ "/mtall.xbm) " "Hinted Full" -> " ^i(" ++ myBitmapsDir ++ "/full.xbm) " "Hinted ThreeCol" -> " ^i(" ++ myBitmapsDir ++ "/threecol.xbm) " _ -> " " ++ x ++ " " ), ppTitle = wrap ("^fg(" ++ myFontColor ++ ")") "^fg()" , ppOutput = hPutStrLn handle } -- }}}