Personal tools

Xmonad/Config archive/brad's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
(haskell tags)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
<pre>
+
<haskell>
 
import XMonad
 
import XMonad
 
import qualified XMonad.StackSet as W
 
import qualified XMonad.StackSet as W
  +
import qualified XMonad.Util.CustomKeys as C
 
import qualified Data.Map as M
 
import qualified Data.Map as M
 
-- hopefully it is obvious what changes i want to impose in xmonad:
 
-- 1. no borders
 
-- 2. urxvt is my terminal
 
-- 3. mod+shift+w launches ff in worksapce 2
 
-- 4. mod+shift+u launches my shell
 
-- 5. mod+shift+l locks the screen
 
-- thats it! thanks to all the posters on xmonad.org whose configs i copied!
 
   
 
main :: IO ()
 
main :: IO ()
Line 19: Line 12:
 
, normalBorderColor = "#000000"
 
, normalBorderColor = "#000000"
 
, focusedBorderColor = "#000000"
 
, focusedBorderColor = "#000000"
, keys = \c -> myKeys c `M.union` keys defaultConfig c
+
, keys = C.customKeys delkeys inskeys
 
, manageHook = manageHook defaultConfig <+> myManageHook
 
, manageHook = manageHook defaultConfig <+> myManageHook
 
}
 
}
+
where
myKeys conf@(XConfig {modMask = modm}) = M.fromList $
+
delkeys :: XConfig l -> [(KeyMask, KeySym)]
[
+
delkeys XConfig {modMask = modm} =
((modm .|. shiftMask, xK_w), spawn "firefox"),
+
[ (modm, xK_b) ]
((modm .|. shiftMask, xK_u), spawn "urxvt -fg white -bg black -vb +sb -fn \"xft:Liberation Mono:pixelsize=20\""),
+
((modm .|. shiftMask, xK_l), spawn "xlock -mode blank")
+
inskeys :: XConfig l -> [((KeyMask, KeySym), X ())]
]
+
inskeys conf@(XConfig {modMask = modm}) =
+
let font = "Monospace"
myManageHook :: ManageHook
+
color = "-fg white -bg black"
myManageHook = composeAll [
+
urxvt = "urxvt -vb +sb" in
className =? "Firefox-bin" --> doF(W.shift "web")
+
[
]
+
((modm .|. shiftMask, xK_w), spawn "firefox"),
</pre>
+
((modm .|. shiftMask, xK_e), spawn
  +
("emacs --font \"" ++ font ++ "-14\" " ++ color)),
  +
((modm .|. shiftMask, xK_u), spawn
  +
(urxvt ++ " " ++ color ++ " -fn \"xft:" ++ font ++
  +
":pixelsize=20\"")),
  +
((modm .|. shiftMask, xK_l), spawn "xlock -mode blank")
  +
]
  +
myManageHook :: ManageHook
  +
myManageHook = composeAll [
  +
className =? "Firefox-bin" --> doF(W.shift "web")
  +
]
  +
</haskell>

Latest revision as of 10:58, 20 December 2008

import XMonad 
import qualified XMonad.StackSet as W
import qualified XMonad.Util.CustomKeys as C
import qualified Data.Map as M
 
main :: IO ()
main = xmonad $ defaultConfig
       { borderWidth        = 0
       , terminal           = "urxvt -bg black -fg white -vb +sb"
       , workspaces         = ["shell", "web"] ++ map show [3..9]
       , normalBorderColor  = "#000000"
       , focusedBorderColor = "#000000"
       , keys = C.customKeys delkeys inskeys
       , manageHook         = manageHook defaultConfig <+> myManageHook
       }
    where
      delkeys :: XConfig l -> [(KeyMask, KeySym)]
      delkeys XConfig {modMask = modm} =
          [ (modm, xK_b) ]
 
      inskeys :: XConfig l -> [((KeyMask, KeySym), X ())]
      inskeys conf@(XConfig {modMask = modm}) =
          let font = "Monospace"
              color = "-fg white -bg black"
              urxvt = "urxvt -vb +sb" in 
          [ 
           ((modm .|. shiftMask, xK_w), spawn "firefox"),
           ((modm .|. shiftMask, xK_e), spawn 
            ("emacs --font \"" ++ font ++ "-14\" " ++ color)),
           ((modm .|. shiftMask, xK_u), spawn 
            (urxvt ++ " " ++ color ++ " -fn \"xft:" ++ font ++ 
             ":pixelsize=20\"")),
           ((modm .|. shiftMask, xK_l), spawn "xlock -mode blank")
          ]
      myManageHook :: ManageHook
      myManageHook = composeAll [
                      className   =? "Firefox-bin" --> doF(W.shift "web")
                     ]