Personal tools

Xmonad/Config archive/And1's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
m
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
'''xmonad.hs'''
  +
 
<haskell>
 
<haskell>
 
------------------------------------------------------------------------
 
------------------------------------------------------------------------
 
-- ~/.xmonad/xmonad.hs
 
-- ~/.xmonad/xmonad.hs
-- validate syntax: $ ghci ~/.xmonad/xmonad.hs
+
-- validate syntax: xmonad --recompile
  +
{-# LANGUAGE NoMonomorphismRestriction #-}
 
------------------------------------------------------------------------
 
------------------------------------------------------------------------
   
 
import XMonad hiding (Tall)
 
import XMonad hiding (Tall)
 
import XMonad.Actions.CycleWS
 
import XMonad.Actions.CycleWS
  +
import XMonad.Actions.FloatKeys
  +
import XMonad.Actions.GridSelect
  +
import XMonad.Hooks.DynamicHooks
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.ManageDocks
 
import XMonad.Hooks.ManageDocks
  +
import XMonad.Hooks.ManageHelpers
 
import XMonad.Hooks.UrgencyHook
 
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.HintedTile
+
import XMonad.Layout.ComboP
  +
import XMonad.Layout.LayoutCombinators hiding ((|||))
 
import XMonad.Layout.LayoutHints
 
import XMonad.Layout.LayoutHints
  +
import XMonad.Layout.NoBorders
 
import XMonad.Layout.PerWorkspace
 
import XMonad.Layout.PerWorkspace
  +
import XMonad.Layout.ResizableTile
  +
import XMonad.Layout.Tabbed
  +
import XMonad.Layout.TwoPane
 
import XMonad.ManageHook
 
import XMonad.ManageHook
 
import XMonad.Prompt
 
import XMonad.Prompt
 
import XMonad.Prompt.Shell
 
import XMonad.Prompt.Shell
 
import XMonad.Util.Run
 
import XMonad.Util.Run
  +
import Control.Monad (liftM2)
  +
import Data.Monoid
  +
import Graphics.X11
  +
import Graphics.X11.Xinerama
 
import System.Exit
 
import System.Exit
 
import System.IO
 
import System.IO
   
import qualified Data.Map as M
 
import qualified System.IO.UTF8
 
 
import qualified XMonad.Actions.FlexibleResize as Flex
 
import qualified XMonad.Actions.FlexibleResize as Flex
 
import qualified XMonad.StackSet as W
 
import qualified XMonad.StackSet as W
  +
import qualified Data.Map as M
   
  +
-- XMonad:
 
main = do
 
main = do
din <- spawnPipe myStatusBar
+
dzen <- spawnPipe myStatusBar
din2 <- spawnPipe myTopBar
+
conkytop <- spawnPipe myTopBar
din3 <- spawnPipe myBottomBar
+
conkympd <- spawnPipe myMPDBar
xmonad $ myUrgencyHook $ defaultConfig
+
conkyhdd <- spawnPipe myHDDBar
  +
xmonad $ myUrgencyHook $ defaultConfig
   
{ normalBorderColor = "#222222"
+
{ terminal = myTerminal
, focusedBorderColor = "#0077cc"
+
, focusFollowsMouse = myFocusFollowsMouse
, terminal = "urxvt"
+
, borderWidth = myBorderWidth
, layoutHook = myLayout
+
, modMask = myModMask
, manageHook = myManageHook <+> manageDocks
+
, workspaces = myWorkspaces
, workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
+
, normalBorderColor = myNormalBorderColor
--, workspaces = ["1:irc", "2:www", "3:music"] ++ map show [4..9]
+
, focusedBorderColor = myFocusedBorderColor
, numlockMask = mod2Mask
 
, modMask = mod1Mask
 
, keys = myKeys
 
, mouseBindings = myMouseBindings
 
, borderWidth = 1
 
, logHook = dynamicLogWithPP $ myLogHook din
 
, focusFollowsMouse = True
 
}
 
   
-- Statusbar options:
+
, keys = myKeys
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1020' -ta 'l' -fg '#f0f0ff' -bg '#222222' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
+
, mouseBindings = myMouseBindings
myTopBar = "conky -c .conkytoprc | dzen2 -x '1020' -y '0' -h '16' -w '580' -ta 'r' -fg '#555555' -bg '#222222' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
 
myBottomBar = "conky -c .conkybottomrc | dzen2 -x '0' -y '1184' -h '16' -w '1600' -ta 'l' -fg '#555555' -bg '#222222' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
 
   
-- Urgency hint options:
+
, layoutHook = myLayout
myUrgencyHook = withUrgencyHook dzenUrgencyHook
+
, manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1600", "-ta", "r", "-expand", "l", "-fg", "#0099ff", "-bg", "#222222", "-fn", "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"] }
+
, handleEventHook = myEventHook
  +
, logHook = dynamicLogWithPP $ myDzenPP_ dzen
  +
, startupHook = myStartupHook
  +
}
   
-- Layout options:
+
myTerminal = "urxvt"
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (hintedTile Wide) $ onWorkspaces ["2:www","3:music","4:nicotine"] (Full) $ (hintedTile Tall ||| hintedTile Wide ||| Full)
+
myFocusFollowsMouse = True
where
+
myBorderWidth = 1
hintedTile = HintedTile nmaster delta ratio TopLeft
+
myModMask = mod1Mask
nmaster = 1
+
myWorkspaces = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc", "6:GIMP", "7:slideshow!", "8:foo()", "9:vbox"]
ratio = toRational (2/(1+sqrt(5)::Double))
+
myNormalBorderColor = "#0f0f0f"
delta = 3/100
+
myFocusedBorderColor = "#1f1f1f"
  +
  +
myEventHook = mempty
  +
myStartupHook = return ()
  +
  +
-- Color, font and iconpath definitions:
  +
myFont = "-*-montecarlo-medium-r-normal-*-11-*-*-*-c-*-*-*"
  +
myIconDir = "/home/and1/.dzen"
  +
myDzenFGColor = "#555555"
  +
myDzenBGColor = "#222222"
  +
myNormalFGColor = "#ffffff"
  +
myNormalBGColor = "#0f0f0f"
  +
myFocusedFGColor = "#f0f0f0"
  +
myFocusedBGColor = "#333333"
  +
myUrgentFGColor = "#0099ff"
  +
myUrgentBGColor = "#0077ff"
  +
myIconFGColor = "#777777"
  +
myIconBGColor = "#0f0f0f"
  +
myPatternColor = "#1f1f1f"
  +
mySeperatorColor = "#555555"
  +
  +
-- GSConfig options:
  +
myGSConfig = defaultGSConfig
  +
{ gs_cellheight = 50
  +
, gs_cellwidth = 250
  +
, gs_cellpadding = 10
  +
, gs_font = "" ++ myFont ++ ""
  +
}
   
 
-- XPConfig options:
 
-- XPConfig options:
 
myXPConfig = defaultXPConfig
 
myXPConfig = defaultXPConfig
{ font = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
+
{ font = "" ++ myFont ++ ""
, bgColor = "#222222"
+
, bgColor = "" ++ myNormalBGColor ++ ""
, fgColor = "#ffffff"
+
, fgColor = "" ++ myNormalFGColor ++ ""
, fgHLight = "#ffffff"
+
, fgHLight = "" ++ myNormalFGColor ++ ""
, bgHLight = "#0066ff"
+
, bgHLight = "" ++ myUrgentBGColor ++ ""
, borderColor = "#ffffff"
+
, borderColor = "" ++ myFocusedBorderColor ++ ""
 
, promptBorderWidth = 1
 
, promptBorderWidth = 1
 
, position = Bottom
 
, position = Bottom
Line 67: Line 81:
 
, historySize = 100
 
, historySize = 100
 
}
 
}
  +
  +
-- Theme options:
  +
myTheme = defaultTheme
  +
{ activeColor = "" ++ myFocusedBGColor ++ ""
  +
, inactiveColor = "" ++ myDzenBGColor ++ ""
  +
, urgentColor = "" ++ myUrgentBGColor ++ ""
  +
, activeBorderColor = "" ++ myFocusedBorderColor ++ ""
  +
, inactiveBorderColor = "" ++ myNormalBorderColor ++ ""
  +
, urgentBorderColor = "" ++ myNormalBorderColor ++ ""
  +
, activeTextColor = "" ++ myFocusedFGColor ++ ""
  +
, inactiveTextColor = "" ++ myDzenFGColor ++ ""
  +
, urgentTextColor = "" ++ myUrgentFGColor ++ ""
  +
, fontName = "" ++ myFont ++ ""
  +
}
  +
  +
-- Statusbar options:
  +
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1300' -ta 'l' -fg '" ++ myNormalFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  +
myTopBar = "conky -c .conkytop | dzen2 -x '1300' -y '0' -h '16' -w '620' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  +
myMPDBar = "conky -c .conkympd | dzen2 -x '0' -y '1184' -h '16' -w '1600' -ta 'l' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  +
myHDDBar = "conky -c .conkyhdd | dzen2 -x '1600' -y '1184' -h '16' -w '320' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  +
  +
-- Urgency hint options:
  +
myUrgencyHook = withUrgencyHook dzenUrgencyHook
  +
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
  +
  +
-- Layouts:
  +
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (resizableTile ||| Mirror resizableTile) $ onWorkspace "6:GIMP" gimpLayout $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
  +
where
  +
resizableTile = ResizableTall nmaster delta ratio []
  +
tabbedLayout = tabbedBottomAlways shrinkText myTheme
  +
gimpLayout = combineTwoP (TwoPane 0.04 0.82) (tabbedLayout) (Full) (Not (Role "gimp-toolbox"))
  +
nmaster = 1
  +
ratio = toRational (2/(1+sqrt(5)::Double))
  +
delta = 3/100
   
 
-- Key bindings:
 
-- Key bindings:
 
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((mod4Mask, xK_q), spawn "urxvt -g 120x40+20+30 -e ssh user@host.tld")
+
[ ((mod4Mask, xK_q), spawn "urxvt -name irssi -e ssh and1@server")
, ((mod4Mask, xK_e), spawn "iceweasel")
+
, ((mod4Mask, xK_w), spawn "nitrogen --no-recurse --sort=alpha")
, ((mod4Mask, xK_r), spawn "urxvt -g 120x40+20+30")
+
, ((mod4Mask, xK_e), spawn "chromium")
, ((mod4Mask, xK_t), spawn "icedove")
+
, ((mod4Mask, xK_r), spawn "urxvt")
, ((mod4Mask, xK_o), spawn "openoffice")
+
, ((mod4Mask .|. shiftMask, xK_r), oneShotHook (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt")
  +
, ((mod4Mask, xK_i), spawn "inkscape")
  +
, ((mod4Mask, xK_o), spawn "libreoffice")
 
, ((mod4Mask, xK_p), shellPrompt myXPConfig)
 
, ((mod4Mask, xK_p), shellPrompt myXPConfig)
  +
, ((mod4Mask, xK_s), spawn "feh --auto-zoom --full-screen --hide-pointer --randomize --slideshow-delay 5 --title \"feh() | %n\" /home/and1/wallpapers/*.jpg /home/and1/wallpapers/*.png")
  +
, ((mod4Mask, xK_f), oneShotHook (className =? "URxvt") doFloat >> spawn "urxvt -g 100x25+25+875") -- MonteCarlo
  +
, ((mod4Mask .|. shiftMask, xK_f), oneShotHook (className =? "URxvt") doFloat >> spawn "urxvt -g 100x10+25+1040") -- MonteCarlo
  +
, ((mod4Mask, xK_g), spawn "gimp")
  +
, ((mod4Mask, xK_k), spawn "k3b")
 
, ((mod4Mask, xK_l), spawn "slock")
 
, ((mod4Mask, xK_l), spawn "slock")
, ((mod4Mask, xK_x), spawn "schroot -p gmpc")
+
, ((mod4Mask, xK_x), spawn "xbmc")
, ((mod4Mask, xK_n), spawn "nicotine")
+
, ((mod4Mask, xK_v), spawn "virtualbox")
, ((mod4Mask, xK_Print), spawn "scrot desk_%Y-%m-%d.png -d 1") -- take screenshot
+
, ((mod4Mask, xK_n), spawn "nautilus")
  +
, ((mod4Mask, xK_m), spawn "gmpc")
  +
, ((mod4Mask, xK_Print), spawn "scrot screen_%Y-%m-%d.png -d 1") -- take screenshot
 
, ((modMask .|. controlMask, xK_Home), spawn "mpc toggle") -- play/pause song
 
, ((modMask .|. controlMask, xK_Home), spawn "mpc toggle") -- play/pause song
 
, ((modMask .|. controlMask, xK_End), spawn "mpc stop") -- stop playback
 
, ((modMask .|. controlMask, xK_End), spawn "mpc stop") -- stop playback
 
, ((modMask .|. controlMask, xK_Prior), spawn "mpc prev") -- previous song
 
, ((modMask .|. controlMask, xK_Prior), spawn "mpc prev") -- previous song
 
, ((modMask .|. controlMask, xK_Next), spawn "mpc next") -- next song
 
, ((modMask .|. controlMask, xK_Next), spawn "mpc next") -- next song
, ((modMask, xK_f), sendMessage NextLayout) -- rotate through the available layout algorithms
 
, ((modMask, xK_n), refresh) -- resize viewed windows to the correct size
 
, ((modMask, xK_m), windows W.swapMaster) -- swap the focused window and the master window
 
 
, ((modMask, xK_Tab), windows W.focusDown) -- move focus to the next window
 
, ((modMask, xK_Tab), windows W.focusDown) -- move focus to the next window
  +
, ((modMask, xK_j), windows W.focusDown) -- move focus to the next window
  +
, ((modMask, xK_k), windows W.focusUp) -- move focus to the previous window
  +
, ((modMask, xK_b), sendMessage ToggleStruts) -- toggle the statusbar gap
  +
, ((modMask, xK_m), windows W.swapMaster) -- swap the focused window and the master window
  +
, ((modMask, xK_comma), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
  +
, ((modMask, xK_period), sendMessage (IncMasterN (-1))) -- deincrement the number of windows in the master area
 
, ((modMask, xK_Return), windows W.focusMaster) -- move focus to the master window
 
, ((modMask, xK_Return), windows W.focusMaster) -- move focus to the master window
, ((modMask, xK_Up), windows W.focusUp) -- move focus to the previous window
+
, ((modMask, xK_f), sendMessage NextLayout) -- rotate through the available layout algorithms
, ((modMask, xK_Down), windows W.focusDown) -- move focus to the next window
+
, ((modMask, xK_g), goToSelected myGSConfig) -- display grid select and go to selected window
  +
, ((modMask, xK_Left), prevWS) -- switch to previous workspace
  +
, ((modMask, xK_Right), nextWS) -- switch to next workspace
 
, ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) -- move focus to the previous window
 
, ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) -- move focus to the previous window
, ((modMask .|. shiftMask, xK_Up), sendMessage Shrink) -- shrink the master area
+
, ((modMask .|. shiftMask, xK_g), gridselectWorkspace myGSConfig W.view) -- display grid select and go to selected workspace
, ((modMask .|. shiftMask, xK_Down), sendMessage Expand) -- expand the master area
+
, ((modMask .|. shiftMask, xK_h), sendMessage Shrink) -- shrink the master area
  +
, ((modMask .|. shiftMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
  +
, ((modMask .|. shiftMask, xK_k), windows W.swapUp) -- swap the focused window with the previous window
  +
, ((modMask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area
  +
, ((modMask .|. shiftMask, xK_Return), focusUrgent) -- move focus to urgent window
 
, ((modMask .|. controlMask, xK_q), io (exitWith ExitSuccess)) -- quit xmonad
 
, ((modMask .|. controlMask, xK_q), io (exitWith ExitSuccess)) -- quit xmonad
, ((modMask .|. controlMask, xK_r), spawn "killall conky dzen2" >> restart "xmonad" True) -- restart xmonad
+
, ((modMask .|. controlMask, xK_r), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart") -- restart xmonad
 
, ((modMask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling
 
, ((modMask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling
 
, ((modMask .|. controlMask, xK_f), setLayout $ XMonad.layoutHook conf) -- reset the layouts on the current workspace to default
 
, ((modMask .|. controlMask, xK_f), setLayout $ XMonad.layoutHook conf) -- reset the layouts on the current workspace to default
  +
, ((modMask .|. controlMask, xK_h), sendMessage MirrorExpand) -- expand the height/width
  +
, ((modMask .|. controlMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
  +
, ((modMask .|. controlMask, xK_k), windows W.swapUp) -- swap the focused window with the previous window
  +
, ((modMask .|. controlMask, xK_l), sendMessage MirrorShrink) -- shrink the height/width
 
, ((modMask .|. controlMask, xK_x), kill) -- close focused window
 
, ((modMask .|. controlMask, xK_x), kill) -- close focused window
, ((modMask .|. controlMask, xK_Left), windows W.swapUp) -- swap the focused window with the previous window
+
, ((modMask .|. controlMask, xK_Left), withFocused (keysMoveWindow (-30,0))) -- move floated window 10 pixels left
, ((modMask .|. controlMask, xK_Right), windows W.swapDown) -- swap the focused window with the next window
+
, ((modMask .|. controlMask, xK_Right), withFocused (keysMoveWindow (30,0))) -- move floated window 10 pixels right
, ((modMask .|. controlMask, xK_Up), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
+
, ((modMask .|. controlMask, xK_Up), withFocused (keysMoveWindow (0,-30))) -- move floated window 10 pixels up
, ((modMask .|. controlMask, xK_Down), sendMessage (IncMasterN (-1))) -- deincrement the number of windows in the master area
+
, ((modMask .|. controlMask, xK_Down), withFocused (keysMoveWindow (0,30))) -- move floated window 10 pixels down
 
]
 
]
 
++
 
++
 
[ ((m .|. modMask, k), windows $ f i)
 
[ ((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_F1 .. xK_F9] -- mod-[F1..F9], Switch to workspace N
+
| (i, k) <- zip (XMonad.workspaces conf) [xK_F1 .. xK_F9] -- mod-[F1..F9], switch to workspace n
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] -- mod-shift-[F1..F9], Move client to workspace N
+
--, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] -- mod-shift-[F1..F9], move window to workspace n
  +
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)] -- mod-shift-[F1..F9], move window to workspace n
 
]
 
]
 
++
 
++
 
[ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
 
[ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_F10, xK_F11, xK_F12] [0..] -- mod-{F10,F11,F12}, Switch to physical/Xinerama screens 1, 2, or 3
+
| (key, sc) <- zip [xK_F10, xK_F11, xK_F12] [0..] -- mod-{F10,F11,F12}, switch to physical/Xinerama screens 1, 2, or 3
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)] -- mod-shift-{F10,F11,F12}, Move client to screen 1, 2, or 3
+
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)] -- mod-shift-{F10,F11,F12}, move window to screen 1, 2, or 3
 
]
 
]
   
 
-- Mouse bindings:
 
-- Mouse bindings:
 
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
 
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w)) -- Set the window to floating mode and move by dragging
+
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster)) -- set the window to floating mode and move by dragging
, ((modMask, button2), (\w -> focus w >> windows W.swapMaster)) -- Raise the window to the top of the stack
+
, ((modMask, button2), (\w -> focus w >> windows W.shiftMaster)) -- raise the window to the top of the stack
, ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) -- Set the window to floating mode and resize by dragging
+
, ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) -- set the window to floating mode and resize by dragging
, ((modMask, button4), (\_ -> prevWS)) -- Switch to previous workspace
+
, ((modMask, button4), (\_ -> prevWS)) -- switch to previous workspace
, ((modMask, button5), (\_ -> nextWS)) -- Switch to next workspace
+
, ((modMask, button5), (\_ -> nextWS)) -- switch to next workspace
 
]
 
]
   
 
-- Window rules:
 
-- Window rules:
 
myManageHook = composeAll . concat $
 
myManageHook = composeAll . concat $
[ [className =? c --> doFloat | c <- myFloats]
+
[ [isDialog --> doFloat]
, [title =? t --> doFloat | t <- myOtherFloats]
+
, [className =? c --> doFloat | c <- myCFloats]
, [resource =? r --> doFloat | r <- myIgnores]
+
, [title =? t --> doFloat | t <- myTFloats]
, [className =? "Firefox-bin" --> doF (W.shift "2:www")]
+
, [resource =? r --> doFloat | r <- myRFloats]
, [className =? "Gmpc" --> doF (W.shift "3:music")]
+
, [resource =? i --> doIgnore | i <- myIgnores]
, [className =? "Nicotine" --> doF (W.shift "4:nicotine")]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "1:irc" | x <- my1Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "2:www" | x <- my2Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "3:music" | x <- my3Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "4:misc" | x <- my4Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "5:xbmc" | x <- my5Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "6:GIMP" | x <- my6Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "7:slideshow!" | x <- my7Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "8:foo()" | x <- my8Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "9:vbox" | x <- my9Shifts]
 
]
 
]
 
where
 
where
myFloats = ["ekiga", "Gimp", "gimp", "MPlayer", "Nitrogen", "Transmission-gtk", "Xmessage", "xmms"]
+
doShiftAndGo = doF . liftM2 (.) W.greedyView W.shift
myOtherFloats = ["Downloads", "Iceweasel Preferences", "Save As...", "Compose: (no subject)", "Icedove Preferences", "Tag and File Name scan", "Preferences...", "Confirm...", "Connect via URL", "Enter Password", "Transfer Files", "Rename", "Make Directory", "Delete Files/Directories", "Getting directory listings", "Options", "Chmod", "Add Bookmark", "Edit Bookmarks", "Delete Bookmarks", "gmpc - Configuration", "gmpc - song info", "Save Playlist", "GQview Preferences", "Inkscape Preferences (Shift+Ctrl+P)", "Select file to open", "Select file to save to", "Warning", "Closing Project - K3b", "Open Files - K3b", "Options - K3b", "Add Config setting", "Edit Config setting", "Close Nicotine-Plus?", "Nicotine Settings", "OpenOffice.org 2.0", "Open", "Options - OpenOffice.org - User Data", "File Properties", "Preference"]
+
myCFloats = ["Ekiga", "MPlayer", "Nitrogen", "Nvidia-settings", "Skype", "Sysinfo", "XCalc", "XFontSel", "Xmessage"]
myIgnores = []
+
myTFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
  +
myRFloats = []
  +
myIgnores = ["desktop_window", "kdesktop"]
  +
my1Shifts = []
  +
my2Shifts = ["Chromium"]
  +
my3Shifts = ["Deadbeef", "Gmpc"]
  +
my4Shifts = ["Eog", "Evince", "Gthumb", "Nautilus", "Pcmanfm", "Pinta"]
  +
my5Shifts = ["MPlayer", "xbmc.bin"]
  +
my6Shifts = ["Gimp"]
  +
my7Shifts = ["feh"]
  +
my8Shifts = ["Easytag", "Gconf-editor", "Inkscape", "K3b", "MusicBrainz Picard", "tmw", "Twf", "VCLSalFrame.DocumentWindow"]
  +
my9Shifts = ["VirtualBox", "Wine"]
   
 
-- dynamicLog pretty printer for dzen:
 
-- dynamicLog pretty printer for dzen:
myLogHook h = defaultPP
+
myDzenPP h = defaultPP
{ ppCurrent = wrap "^fg(#0099ff)^bg(#444444)^p()^i(/home/and1/.dzen/plus.xbm)^fg(#ffffff)" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
{ ppCurrent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
, ppVisible = wrap "^fg(#ffffff)^bg(#444444)^p()^i(/home/and1/.dzen/plus.xbm)^fg(#ffffff)" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppVisible = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
, ppHidden = wrap "^i(/home/and1/.dzen/plus.xbm)" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
+
, ppHidden = wrap ("^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
, ppHiddenNoWindows = wrap "^fg(#777777)^bg()^p()^i(/home/and1/.dzen/plus.xbm)" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
--, ppHiddenNoWindows = wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> dropIx wsId
, ppUrgent = wrap "^fg(#0099ff)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . dropIx $ wsId
  +
, ppUrgent = wrap (("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myUrgentFGColor ++ ")")) "^fg()^bg()^p()" . \wsId -> dropIx wsId
 
, ppSep = " "
 
, ppSep = " "
 
, ppWsSep = " "
 
, ppWsSep = " "
, ppTitle = dzenColor "#ffffff" "" . wrap "< " " >"
+
, ppTitle = dzenColor ("" ++ myNormalFGColor ++ "") "" . wrap "< " " >"
, ppLayout = dzenColor "#ffffff" "" .
+
, ppLayout = dzenColor ("" ++ myNormalFGColor ++ "") "" .
 
(\x -> case x of
 
(\x -> case x of
"Hinted Tall" -> "^fg(#777777)^i(/home/and1/.dzen/layout-tall-right.xbm)"
+
"Hinted Full" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-full.xbm)"
"Hinted Wide" -> "^fg(#777777)^i(/home/and1/.dzen/layout-mirror-bottom.xbm)"
+
"Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
"Hinted Full" -> "^fg(#777777)^i(/home/and1/.dzen/layout-full.xbm)"
+
"Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.xbm)"
  +
--"Hinted combining Tabbed Bottom Simplest and Full with DragPane Vertical 0.1 0.8" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  +
"Hinted combining Tabbed Bottom Simplest and Full with TwoPane using Not (Role \"gimp-toolbox\")" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  +
_ -> x
 
)
 
)
, ppOutput = System.IO.UTF8.hPutStrLn h
+
, ppOutput = hPutStrLn h
 
}
 
}
  +
where
  +
dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
  +
staticWs = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc"]
  +
  +
-- dynamicLog pretty printer for dzen:
  +
myDzenPP_ h = defaultPP
  +
{ ppCurrent = wrap ("^p(2)^ib(1)^fg(" ++ myFocusedBGColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()``^fg(" ++ myNormalFGColor ++ ")^p(2)") ("^p(2)^fg(" ++ myFocusedBGColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
  +
, ppVisible = wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()``^fg(" ++ myNormalFGColor ++ ")^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
  +
, ppHidden = wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg()^bg()^p()``^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^p()^ib(0)^fg()^bg()^p()") . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
  +
, ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myDzenFGColor ++ ")^bg()^p()``^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . dropIx $ wsId
  +
, ppUrgent = wrap (("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()``^fg(" ++ myUrgentFGColor ++ ")^p(2)")) ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
  +
, ppSep = " "
  +
, ppWsSep = ""
  +
, ppTitle = dzenColor ("" ++ myNormalFGColor ++ "") "" . wrap ("^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^p(2)^fg()< ") (" >^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()")
  +
, ppLayout = dzenColor ("" ++ myNormalFGColor ++ "") "" .
  +
(\x -> case x of
  +
"Hinted Full" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-full.xbm)"
  +
"Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
  +
"Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.xbm)"
  +
--"Hinted combining Tabbed Bottom Simplest and Full with DragPane Vertical 0.1 0.8" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  +
"Hinted combining Tabbed Bottom Simplest and Full with TwoPane using Not (Role \"gimp-toolbox\")" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  +
_ -> x
  +
)
  +
, ppOutput = hPutStrLn h
  +
}
  +
where
  +
dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
  +
staticWs = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc"]
 
</haskell>
 
</haskell>
  +
  +
  +
'''.xinitrc'''
  +
  +
<pre>
  +
#!/bin/sh
  +
  +
#
  +
# ~/.xinitrc
  +
#
  +
# Executed by startx (run your window manager from here)
  +
#
  +
  +
xrandr -s 0
  +
  +
xrdb -load $HOME/.Xdefaults
  +
  +
xsetroot -cursor_name left_ptr
  +
#xsetroot -solid '#0f0f0f'
  +
  +
xset b off
  +
xset s off
  +
xset -dpms
  +
  +
#xmodmap -e "keysym Super_R = SunCompose"
  +
  +
fbsetbg -b -solid "#0f0f0f"
  +
#nitrogen --restore
  +
  +
xcompmgr &
  +
#{ sleep 1; urxvt -name ncmpcpp-clock -e ncmpcpp; } &
  +
#{ sleep 2; urxvt -name ncmpcpp-visualizer -e ncmpcpp; } &
  +
#{ sleep 3; urxvt -name screen -e screen; } &
  +
#{ sleep 4; urxvt -name irssi -e ssh and1@server; } &
  +
#chromium-browser &
  +
#gmpc &
  +
  +
export MPD_HOST=localhost
  +
export MPD_PORT=6600
  +
export OOO_FORCE_DESKTOP=gnome
  +
  +
exec xmonad > $HOME/.xmonad/log.txt 2>&1
  +
</pre>

Latest revision as of 15:36, 4 December 2012

xmonad.hs

------------------------------------------------------------------------
-- ~/.xmonad/xmonad.hs
-- validate syntax: xmonad --recompile
{-# LANGUAGE NoMonomorphismRestriction #-}
------------------------------------------------------------------------
 
import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Actions.FloatKeys
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.ComboP
import XMonad.Layout.LayoutCombinators hiding ((|||))
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.TwoPane
import XMonad.ManageHook
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run
import Control.Monad (liftM2)
import Data.Monoid
import Graphics.X11
import Graphics.X11.Xinerama
import System.Exit
import System.IO
 
import qualified XMonad.Actions.FlexibleResize as Flex
import qualified XMonad.StackSet as W
import qualified Data.Map as M
 
-- XMonad:
main = do
  dzen <- spawnPipe myStatusBar
  conkytop <- spawnPipe myTopBar
  conkympd <- spawnPipe myMPDBar
  conkyhdd <- spawnPipe myHDDBar
  xmonad $ myUrgencyHook $ defaultConfig
 
    { terminal           = myTerminal
    , focusFollowsMouse  = myFocusFollowsMouse
    , borderWidth        = myBorderWidth
    , modMask            = myModMask
    , workspaces         = myWorkspaces
    , normalBorderColor  = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
 
    , keys               = myKeys
    , mouseBindings      = myMouseBindings
 
    , layoutHook         = myLayout
    , manageHook         = myManageHook <+> manageDocks <+> dynamicMasterHook
    , handleEventHook    = myEventHook
    , logHook            = dynamicLogWithPP $ myDzenPP_ dzen
    , startupHook        = myStartupHook
    }
 
myTerminal = "urxvt"
myFocusFollowsMouse = True
myBorderWidth = 1
myModMask = mod1Mask
myWorkspaces = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc", "6:GIMP", "7:slideshow!", "8:foo()", "9:vbox"]
myNormalBorderColor = "#0f0f0f"
myFocusedBorderColor = "#1f1f1f"
 
myEventHook = mempty
myStartupHook = return ()
 
-- Color, font and iconpath definitions:
myFont = "-*-montecarlo-medium-r-normal-*-11-*-*-*-c-*-*-*"
myIconDir = "/home/and1/.dzen"
myDzenFGColor = "#555555"
myDzenBGColor = "#222222"
myNormalFGColor = "#ffffff"
myNormalBGColor = "#0f0f0f"
myFocusedFGColor = "#f0f0f0"
myFocusedBGColor = "#333333"
myUrgentFGColor = "#0099ff"
myUrgentBGColor = "#0077ff"
myIconFGColor = "#777777"
myIconBGColor = "#0f0f0f"
myPatternColor = "#1f1f1f"
mySeperatorColor = "#555555"
 
-- GSConfig options:
myGSConfig = defaultGSConfig
    { gs_cellheight = 50
    , gs_cellwidth = 250
    , gs_cellpadding = 10
    , gs_font = "" ++ myFont ++ ""
    }
 
-- XPConfig options:
myXPConfig = defaultXPConfig
    { font = "" ++ myFont ++ ""
    , bgColor = "" ++ myNormalBGColor ++ ""
    , fgColor = "" ++ myNormalFGColor ++ ""
    , fgHLight = "" ++ myNormalFGColor ++ ""
    , bgHLight = "" ++ myUrgentBGColor ++ ""
    , borderColor = "" ++ myFocusedBorderColor ++ ""
    , promptBorderWidth = 1
    , position = Bottom
    , height = 16
    , historySize = 100
    }
 
-- Theme options:
myTheme = defaultTheme
    { activeColor = "" ++ myFocusedBGColor ++ ""
    , inactiveColor = "" ++ myDzenBGColor ++ ""
    , urgentColor = "" ++ myUrgentBGColor ++ ""
    , activeBorderColor = "" ++ myFocusedBorderColor ++ ""
    , inactiveBorderColor = "" ++ myNormalBorderColor ++ ""
    , urgentBorderColor = "" ++ myNormalBorderColor ++ ""
    , activeTextColor = "" ++ myFocusedFGColor ++ ""
    , inactiveTextColor = "" ++ myDzenFGColor ++ ""
    , urgentTextColor = "" ++ myUrgentFGColor ++ ""
    , fontName = "" ++ myFont ++ ""
    }
 
-- Statusbar options:
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1300' -ta 'l' -fg '" ++ myNormalFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myTopBar = "conky -c .conkytop | dzen2 -x '1300' -y '0' -h '16' -w '620' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myMPDBar = "conky -c .conkympd | dzen2 -x '0' -y '1184' -h '16' -w '1600' -ta 'l' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myHDDBar = "conky -c .conkyhdd | dzen2 -x '1600' -y '1184' -h '16' -w '320' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
 
-- Urgency hint options:
myUrgencyHook = withUrgencyHook dzenUrgencyHook
    { args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
 
-- Layouts:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (resizableTile ||| Mirror resizableTile) $ onWorkspace "6:GIMP" gimpLayout $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    tabbedLayout = tabbedBottomAlways shrinkText myTheme
    gimpLayout = combineTwoP (TwoPane 0.04 0.82) (tabbedLayout) (Full) (Not (Role "gimp-toolbox"))
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100
 
-- Key bindings:
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((mod4Mask, xK_q), spawn "urxvt -name irssi -e ssh and1@server")
    , ((mod4Mask, xK_w), spawn "nitrogen --no-recurse --sort=alpha")
    , ((mod4Mask, xK_e), spawn "chromium")
    , ((mod4Mask, xK_r), spawn "urxvt")
    , ((mod4Mask .|. shiftMask, xK_r), oneShotHook (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt")
    , ((mod4Mask, xK_i), spawn "inkscape")
    , ((mod4Mask, xK_o), spawn "libreoffice")
    , ((mod4Mask, xK_p), shellPrompt myXPConfig)
    , ((mod4Mask, xK_s), spawn "feh --auto-zoom --full-screen --hide-pointer --randomize --slideshow-delay 5 --title \"feh() | %n\" /home/and1/wallpapers/*.jpg /home/and1/wallpapers/*.png")
    , ((mod4Mask, xK_f), oneShotHook (className =? "URxvt") doFloat >> spawn "urxvt -g 100x25+25+875") -- MonteCarlo
    , ((mod4Mask .|. shiftMask, xK_f), oneShotHook (className =? "URxvt") doFloat >> spawn "urxvt -g 100x10+25+1040") -- MonteCarlo
    , ((mod4Mask, xK_g), spawn "gimp")
    , ((mod4Mask, xK_k), spawn "k3b")
    , ((mod4Mask, xK_l), spawn "slock")
    , ((mod4Mask, xK_x), spawn "xbmc")
    , ((mod4Mask, xK_v), spawn "virtualbox")
    , ((mod4Mask, xK_n), spawn "nautilus")
    , ((mod4Mask, xK_m), spawn "gmpc")
    , ((mod4Mask, xK_Print), spawn "scrot screen_%Y-%m-%d.png -d 1") -- take screenshot
    , ((modMask .|. controlMask, xK_Home), spawn "mpc toggle") -- play/pause song
    , ((modMask .|. controlMask, xK_End), spawn "mpc stop") -- stop playback
    , ((modMask .|. controlMask, xK_Prior), spawn "mpc prev") -- previous song
    , ((modMask .|. controlMask, xK_Next), spawn "mpc next") -- next song
    , ((modMask, xK_Tab), windows W.focusDown) -- move focus to the next window
    , ((modMask, xK_j), windows W.focusDown) -- move focus to the next window
    , ((modMask, xK_k), windows W.focusUp) -- move focus to the previous window
    , ((modMask, xK_b), sendMessage ToggleStruts) -- toggle the statusbar gap
    , ((modMask, xK_m), windows W.swapMaster) -- swap the focused window and the master window
    , ((modMask, xK_comma), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
    , ((modMask, xK_period), sendMessage (IncMasterN (-1))) -- deincrement the number of windows in the master area
    , ((modMask, xK_Return), windows W.focusMaster) -- move focus to the master window
    , ((modMask, xK_f), sendMessage NextLayout) -- rotate through the available layout algorithms
    , ((modMask, xK_g), goToSelected myGSConfig) -- display grid select and go to selected window
    , ((modMask, xK_Left), prevWS) -- switch to previous workspace
    , ((modMask, xK_Right), nextWS) -- switch to next workspace
    , ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) -- move focus to the previous window
    , ((modMask .|. shiftMask, xK_g), gridselectWorkspace myGSConfig W.view) -- display grid select and go to selected workspace
    , ((modMask .|. shiftMask, xK_h), sendMessage Shrink) -- shrink the master area
    , ((modMask .|. shiftMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. shiftMask, xK_k), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area
    , ((modMask .|. shiftMask, xK_Return), focusUrgent) -- move focus to urgent window
    , ((modMask .|. controlMask, xK_q), io (exitWith ExitSuccess)) -- quit xmonad
    , ((modMask .|. controlMask, xK_r), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart") -- restart xmonad
    , ((modMask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling
    , ((modMask .|. controlMask, xK_f), setLayout $ XMonad.layoutHook conf) -- reset the layouts on the current workspace to default
    , ((modMask .|. controlMask, xK_h), sendMessage MirrorExpand) -- expand the height/width
    , ((modMask .|. controlMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. controlMask, xK_k), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. controlMask, xK_l), sendMessage MirrorShrink) -- shrink the height/width
    , ((modMask .|. controlMask, xK_x), kill) -- close focused window
    , ((modMask .|. controlMask, xK_Left), withFocused (keysMoveWindow (-30,0))) -- move floated window 10 pixels left
    , ((modMask .|. controlMask, xK_Right), withFocused (keysMoveWindow (30,0))) -- move floated window 10 pixels right
    , ((modMask .|. controlMask, xK_Up), withFocused (keysMoveWindow (0,-30))) -- move floated window 10 pixels up
    , ((modMask .|. controlMask, xK_Down), withFocused (keysMoveWindow (0,30))) -- move floated window 10 pixels down
    ]
    ++
    [ ((m .|. modMask, k), windows $ f i)
    | (i, k) <- zip (XMonad.workspaces conf) [xK_F1 .. xK_F9] -- mod-[F1..F9], switch to workspace n
    --, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] -- mod-shift-[F1..F9], move window to workspace n
    , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] -- mod-shift-[F1..F9], move window to workspace n
    ]
    ++
    [ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
    | (key, sc) <- zip [xK_F10, xK_F11, xK_F12] [0..] -- mod-{F10,F11,F12}, switch to physical/Xinerama screens 1, 2, or 3
    , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] -- mod-shift-{F10,F11,F12}, move window to screen 1, 2, or 3
    ]
 
-- Mouse bindings:
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster)) -- set the window to floating mode and move by dragging
    , ((modMask, button2), (\w -> focus w >> windows W.shiftMaster)) -- raise the window to the top of the stack
    , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) -- set the window to floating mode and resize by dragging
    , ((modMask, button4), (\_ -> prevWS)) -- switch to previous workspace
    , ((modMask, button5), (\_ -> nextWS)) -- switch to next workspace
    ]
 
-- Window rules:
myManageHook = composeAll . concat $
    [ [isDialog --> doFloat]
    , [className =? c --> doFloat | c <- myCFloats]
    , [title =? t --> doFloat | t <- myTFloats]
    , [resource =? r --> doFloat | r <- myRFloats]
    , [resource =? i --> doIgnore | i <- myIgnores]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShift "1:irc" | x <- my1Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShift "2:www" | x <- my2Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShift "3:music" | x <- my3Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "4:misc" | x <- my4Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "5:xbmc" | x <- my5Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "6:GIMP" | x <- my6Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "7:slideshow!" | x <- my7Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "8:foo()" | x <- my8Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "9:vbox" | x <- my9Shifts]
    ]
    where
    doShiftAndGo = doF . liftM2 (.) W.greedyView W.shift
    myCFloats = ["Ekiga", "MPlayer", "Nitrogen", "Nvidia-settings", "Skype", "Sysinfo", "XCalc", "XFontSel", "Xmessage"]
    myTFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
    myRFloats = []
    myIgnores = ["desktop_window", "kdesktop"]
    my1Shifts = []
    my2Shifts = ["Chromium"]
    my3Shifts = ["Deadbeef", "Gmpc"]
    my4Shifts = ["Eog", "Evince", "Gthumb", "Nautilus", "Pcmanfm", "Pinta"]
    my5Shifts = ["MPlayer", "xbmc.bin"]
    my6Shifts = ["Gimp"]
    my7Shifts = ["feh"]
    my8Shifts = ["Easytag", "Gconf-editor", "Inkscape", "K3b", "MusicBrainz Picard", "tmw", "Twf", "VCLSalFrame.DocumentWindow"]
    my9Shifts = ["VirtualBox", "Wine"]
 
-- dynamicLog pretty printer for dzen:
myDzenPP h = defaultPP
    { ppCurrent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
    , ppVisible = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
    , ppHidden = wrap ("^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
    --, ppHiddenNoWindows = wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> dropIx wsId
    , ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . dropIx $ wsId
    , ppUrgent = wrap (("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myUrgentFGColor ++ ")")) "^fg()^bg()^p()" . \wsId -> dropIx wsId
    , ppSep = " "
    , ppWsSep = " "
    , ppTitle = dzenColor ("" ++ myNormalFGColor ++ "") "" . wrap "< " " >"
    , ppLayout = dzenColor ("" ++ myNormalFGColor ++ "") "" .
        (\x -> case x of
        "Hinted Full" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-full.xbm)"
        "Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
        "Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.xbm)"
        --"Hinted combining Tabbed Bottom Simplest and Full with DragPane  Vertical 0.1 0.8" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
        "Hinted combining Tabbed Bottom Simplest and Full with TwoPane using Not (Role \"gimp-toolbox\")" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }
    where
    dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
    staticWs = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc"]
 
-- dynamicLog pretty printer for dzen:
myDzenPP_ h = defaultPP
    { ppCurrent = wrap ("^p(2)^ib(1)^fg(" ++ myFocusedBGColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()``^fg(" ++ myNormalFGColor ++ ")^p(2)") ("^p(2)^fg(" ++ myFocusedBGColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
    , ppVisible = wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()``^fg(" ++ myNormalFGColor ++ ")^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
    , ppHidden = wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg()^bg()^p()``^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^p()^ib(0)^fg()^bg()^p()") . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
    , ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myDzenFGColor ++ ")^bg()^p()``^p(2)") ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . dropIx $ wsId
    , ppUrgent = wrap (("^p(2)^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()``^fg(" ++ myUrgentFGColor ++ ")^p(2)")) ("^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()^bg()^p()") . \wsId -> dropIx wsId
    , ppSep = " "
    , ppWsSep = ""
    , ppTitle = dzenColor ("" ++ myNormalFGColor ++ "") "" . wrap ("^ib(1)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_left.xbm)^r(1300x12)^p(-1300)^p(2)^fg()< ") (" >^p(2)^fg(" ++ myPatternColor ++ ")^i(" ++ myIconDir ++ "/corner_right.xbm)^fg(" ++ myNormalBGColor ++ ")^r(1300x12)^p(-1300)^ib(0)^fg()")
    , ppLayout = dzenColor ("" ++ myNormalFGColor ++ "") "" .
        (\x -> case x of
        "Hinted Full" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-full.xbm)"
        "Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
        "Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.xbm)"
        --"Hinted combining Tabbed Bottom Simplest and Full with DragPane  Vertical 0.1 0.8" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
        "Hinted combining Tabbed Bottom Simplest and Full with TwoPane using Not (Role \"gimp-toolbox\")" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }
    where
    dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
    staticWs = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc"]


.xinitrc

#!/bin/sh

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

xrandr -s 0

xrdb -load $HOME/.Xdefaults

xsetroot -cursor_name left_ptr
#xsetroot -solid '#0f0f0f'

xset b off
xset s off
xset -dpms

#xmodmap -e "keysym Super_R = SunCompose"

fbsetbg -b -solid "#0f0f0f"
#nitrogen --restore

xcompmgr &
#{ sleep 1; urxvt -name ncmpcpp-clock -e ncmpcpp; } &
#{ sleep 2; urxvt -name ncmpcpp-visualizer -e ncmpcpp; } &
#{ sleep 3; urxvt -name screen -e screen; } &
#{ sleep 4; urxvt -name irssi -e ssh and1@server; } &
#chromium-browser &
#gmpc &

export MPD_HOST=localhost
export MPD_PORT=6600
export OOO_FORCE_DESKTOP=gnome

exec xmonad > $HOME/.xmonad/log.txt 2>&1