Personal tools

Xmonad/Config archive/And1's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
m
(updated to 0.9 darcs)
Line 10: Line 10:
 
import XMonad.Actions.CycleWS
 
import XMonad.Actions.CycleWS
 
import XMonad.Actions.FloatKeys
 
import XMonad.Actions.FloatKeys
import XMonad.Actions.WithAll
 
 
import XMonad.Hooks.DynamicHooks
 
import XMonad.Hooks.DynamicHooks
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.FadeInactive
 
 
import XMonad.Hooks.ManageDocks
 
import XMonad.Hooks.ManageDocks
  +
import XMonad.Hooks.ManageHelpers
 
import XMonad.Hooks.UrgencyHook
 
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.NoBorders
+
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.ResizableTile
  +
import XMonad.Layout.Tabbed
 
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 XMonad.Util.WorkspaceCompare
  +
import Control.Monad (liftM2)
  +
import Data.Monoid
 
import Graphics.X11
 
import Graphics.X11
 
import System.Exit
 
import System.Exit
 
import System.IO
 
import System.IO
   
import qualified Data.Map as M
 
 
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
 
--xmobar <- spawnPipe myStatusBar
 
--xmobar <- spawnPipe myStatusBar
Line 41: Line 46:
 
xmonad $ myUrgencyHook $ defaultConfig
 
xmonad $ myUrgencyHook $ defaultConfig
   
{ terminal = "urxvt"
+
{ terminal = myTerminal
, borderWidth = 1
+
, focusFollowsMouse = myFocusFollowsMouse
, keys = myKeys dynHooksRef
+
, borderWidth = myBorderWidth
, modMask = mod1Mask
+
, modMask = myModMask
, numlockMask = mod2Mask
+
, numlockMask = myNumlockMask
, focusFollowsMouse = True
+
, workspaces = myWorkspaces
, mouseBindings = myMouseBindings
+
, normalBorderColor = myNormalBorderColor
, normalBorderColor = "#0f0f0f"
+
, focusedBorderColor = myFocusedBorderColor
, focusedBorderColor = "#1f1f1f"
+
, layoutHook = myLayout
+
, keys = myKeys dynHooksRef
, logHook = dynamicLogWithPP (myDzenPP dzen) >> fadeInactiveLogHook 0x99999999
+
, mouseBindings = myMouseBindings
--, logHook = dynamicLogWithPP $ myXmobarPP xmobar
+
, manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
+
, layoutHook = myLayout
, workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
+
, manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
  +
, handleEventHook = myEventHook
  +
, logHook = dynamicLogWithPP $ myDzenPP dzen
  +
--, logHook = dynamicLogWithPP $ myXmobarPP xmobar
  +
, startupHook = myStartupHook
 
}
 
}
  +
  +
myTerminal = "urxvt"
  +
myFocusFollowsMouse = True
  +
myBorderWidth = 1
  +
myModMask = mod1Mask
  +
myNumlockMask = mod2Mask
  +
myWorkspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc", "6:gimp", "7:mplayer", "8:foo", "9:vbox"]
  +
myNormalBorderColor = "#0f0f0f"
  +
myFocusedBorderColor = "#1f1f1f"
  +
  +
myEventHook = mempty
  +
--myLogHook = dynamicLogWithPP $ myDzenPP dzen
  +
myStartupHook = return ()
   
 
-- Color, font and iconpath definitions:
 
-- Color, font and iconpath definitions:
myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
+
--myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
  +
myFont = "-*-montecarlo-medium-r-normal-*-11-*-*-*-c-*-*-*"
 
myIconDir = "/home/and1/.dzen"
 
myIconDir = "/home/and1/.dzen"
 
myDzenFGColor = "#555555"
 
myDzenFGColor = "#555555"
myDzenBGColor = ""
+
myDzenBGColor = "#222222"
 
myNormalFGColor = "#ffffff"
 
myNormalFGColor = "#ffffff"
 
myNormalBGColor = "#0f0f0f"
 
myNormalBGColor = "#0f0f0f"
Line 69: Line 87:
 
myUrgentBGColor = "#0077ff"
 
myUrgentBGColor = "#0077ff"
 
myIconFGColor = "#777777"
 
myIconFGColor = "#777777"
myIconBGColor = ""
+
myIconBGColor = "#0f0f0f"
 
mySeperatorColor = "#555555"
 
mySeperatorColor = "#555555"
  +
  +
-- XPConfig options:
  +
myXPConfig = defaultXPConfig
  +
{ font = "" ++ myFont ++ ""
  +
, bgColor = "" ++ myNormalBGColor ++ ""
  +
, fgColor = "" ++ myNormalFGColor ++ ""
  +
, fgHLight = "" ++ myNormalFGColor ++ ""
  +
, bgHLight = "" ++ myUrgentBGColor ++ ""
  +
, borderColor = "" ++ myFocusedBorderColor ++ ""
  +
, promptBorderWidth = 1
  +
, position = Bottom
  +
, height = 16
  +
, historySize = 100
  +
--, historyFilter = ""
  +
--, promptKeymap = ""
  +
--, completionKey = ""
  +
--, defaultText = ""
  +
--, autoComplete = "KeySym"
  +
--, showCompletionOnTab = ""
  +
}
  +
  +
-- Theme options:
  +
myTheme = defaultTheme
  +
{ activeColor = "" ++ myFocusedBGColor ++ ""
  +
, inactiveColor = "" ++ myDzenBGColor ++ ""
  +
, urgentColor = "" ++ myUrgentBGColor ++ ""
  +
, activeBorderColor = "" ++ myFocusedBorderColor ++ ""
  +
, inactiveBorderColor = "" ++ myNormalBorderColor ++ ""
  +
, urgentBorderColor = "" ++ myNormalBorderColor ++ ""
  +
, activeTextColor = "" ++ myFocusedFGColor ++ ""
  +
, inactiveTextColor = "" ++ myDzenFGColor ++ ""
  +
, urgentTextColor = "" ++ myUrgentFGColor ++ ""
  +
, fontName = "" ++ myFont ++ ""
  +
--, decoWidth = ""
  +
--, decoHeight = ""
  +
}
   
 
-- Statusbar options:
 
-- Statusbar options:
Line 83: Line 137:
 
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
 
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
   
-- Layout options:
+
-- Layouts:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (resizableTile ||| Mirror resizableTile) $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
+
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (resizableTile ||| Mirror resizableTile) $ onWorkspace "6:gimp" gimpLayout $ (Full ||| resizableTile ||| Mirror resizableTile)
 
where
 
where
 
resizableTile = ResizableTall nmaster delta ratio []
 
resizableTile = ResizableTall nmaster delta ratio []
  +
tabbedLayout = tabbedBottomAlways shrinkText myTheme
  +
gimpLayout = tabbedLayout ****||* Full
 
nmaster = 1
 
nmaster = 1
 
ratio = toRational (2/(1+sqrt(5)::Double))
 
ratio = toRational (2/(1+sqrt(5)::Double))
 
delta = 3/100
 
delta = 3/100
 
-- XPConfig options:
 
myXPConfig = defaultXPConfig
 
{ font = "" ++ myFont ++ ""
 
, bgColor = "" ++ myFocusedBGColor ++ ""
 
, fgColor = "" ++ myNormalFGColor ++ ""
 
, fgHLight = "" ++ myNormalFGColor ++ ""
 
, bgHLight = "" ++ myUrgentBGColor ++ ""
 
, borderColor = "" ++ myNormalFGColor ++ ""
 
, promptBorderWidth = 1
 
, position = Bottom
 
, height = 16
 
, historySize = 100
 
}
 
   
 
-- Key bindings:
 
-- Key bindings:
 
myKeys dynHooksRef conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
myKeys dynHooksRef conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((mod4Mask, xK_q), spawn "urxvt -e ssh and1@domain.net")
+
[ ((mod4Mask, xK_q), spawn "urxvt -e ssh and1@donnergurgler.net")
 
, ((mod4Mask, xK_w), spawn "nitrogen --no-recurse --sort=alpha /home/and1/wallpapers/")
 
, ((mod4Mask, xK_w), spawn "nitrogen --no-recurse --sort=alpha /home/and1/wallpapers/")
 
, ((mod4Mask, xK_e), spawn "iceweasel")
 
, ((mod4Mask, xK_e), spawn "iceweasel")
 
, ((mod4Mask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapDown . W.shiftMaster)) >> spawn "urxvt")
 
, ((mod4Mask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapDown . W.shiftMaster)) >> spawn "urxvt")
  +
, ((mod4Mask, xK_r), spawn "urxvt")
 
, ((mod4Mask .|. shiftMask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt")
 
, ((mod4Mask .|. shiftMask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt")
 
, ((mod4Mask, xK_o), spawn "openoffice")
 
, ((mod4Mask, xK_o), spawn "openoffice")
Line 116: Line 159:
 
, ((mod4Mask, xK_d), spawn "date +'%Y-%m-%d %H:%M' | osd_cat -p bottom -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
 
, ((mod4Mask, xK_d), spawn "date +'%Y-%m-%d %H:%M' | osd_cat -p bottom -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
 
, ((mod4Mask .|. shiftMask, xK_d), spawn "date +'%H:%M' | osd_cat -p middle -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
 
, ((mod4Mask .|. shiftMask, xK_d), spawn "date +'%H:%M' | osd_cat -p middle -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
, ((mod4Mask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 120x40+930+40")
+
, ((mod4Mask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 80x25+25+765")
, ((mod4Mask .|. shiftMask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 180x10+20+1020")
+
, ((mod4Mask .|. shiftMask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 140x10+25+975")
 
, ((mod4Mask, xK_g), spawn "gimp")
 
, ((mod4Mask, xK_g), spawn "gimp")
 
, ((mod4Mask, xK_k), spawn "k3b")
 
, ((mod4Mask, xK_k), spawn "k3b")
Line 130: Line 173:
 
, ((modMask .|. controlMask, xK_Next), spawn "mpc next") -- next song
 
, ((modMask .|. controlMask, xK_Next), spawn "mpc next") -- next song
 
, ((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.focusUp) -- move focus to the previous window
+
, ((modMask, xK_j), windows W.focusDown) -- move focus to the next window
, ((modMask, xK_k), windows W.focusDown) -- move focus to the next window
+
, ((modMask, xK_k), windows W.focusUp) -- move focus to the previous window
, ((modMask, xK_n), refresh) -- resize viewed windows to the correct size
+
--, ((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_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_comma), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
Line 140: Line 183:
 
, ((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_h), sendMessage Shrink) -- shrink the master area
 
, ((modMask .|. shiftMask, xK_h), sendMessage Shrink) -- shrink the master area
, ((modMask .|. shiftMask, xK_j), windows W.swapUp) -- swap the focused window with the previous window
+
, ((modMask .|. shiftMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
, ((modMask .|. shiftMask, xK_k), 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_l), sendMessage Expand) -- expand the master area
 
, ((modMask .|. shiftMask, xK_Return), focusUrgent) -- move focus to urgent window
 
, ((modMask .|. shiftMask, xK_Return), focusUrgent) -- move focus to urgent window
, ((modMask .|. shiftMask, xK_Left), withFocused (keysResizeWindow (-30,0) (0,0))) -- shrink floated window horizontally by 50 pixels
+
--, ((modMask .|. shiftMask, xK_Left), withFocused (keysResizeWindow (-30,0) (0,0))) -- shrink floated window horizontally by 50 pixels
, ((modMask .|. shiftMask, xK_Right), withFocused (keysResizeWindow (30,0) (0,0))) -- expand floated window horizontally by 50 pixels
+
--, ((modMask .|. shiftMask, xK_Right), withFocused (keysResizeWindow (30,0) (0,0))) -- expand floated window horizontally by 50 pixels
, ((modMask .|. shiftMask, xK_Up), withFocused (keysResizeWindow (-30,-30) (0,0))) -- shrink floated window by 50 pixels
+
--, ((modMask .|. shiftMask, xK_Up), withFocused (keysResizeWindow (-30,-30) (0,0))) -- shrink floated window by 50 pixels
, ((modMask .|. shiftMask, xK_Down), withFocused (keysResizeWindow (30,30) (0,0))) -- expand floated window by 50 pixels
+
--, ((modMask .|. shiftMask, xK_Down), withFocused (keysResizeWindow (30,30) (0,0))) -- expand floated window by 50 pixels
 
, ((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 && sleep 0.5" >> 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/wide
+
, ((modMask .|. controlMask, xK_h), sendMessage MirrorExpand) -- expand the height/width
, ((modMask .|. controlMask, xK_j), windows W.swapUp) -- swap the focused window with the previous window
+
, ((modMask .|. controlMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
, ((modMask .|. controlMask, xK_k), 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/wide
+
, ((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), withFocused (keysMoveWindow (-30,0))) -- move floated window 10 pixels left
 
, ((modMask .|. controlMask, xK_Left), withFocused (keysMoveWindow (-30,0))) -- move floated window 10 pixels left
Line 175: Line 218:
 
-- 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
Line 187: Line 230:
 
, [title =? t --> doFloat | t <- myTFloats]
 
, [title =? t --> doFloat | t <- myTFloats]
 
, [resource =? r --> doFloat | r <- myRFloats]
 
, [resource =? r --> doFloat | r <- myRFloats]
, [className =? "Iceweasel" --> doShift "2:www"]
+
, [resource =? i --> doIgnore | i <- myIgnores]
, [className =? "Gmpc" --> doShift "3:music"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "1:irc" | x <- my1Shifts]
, [className =? "Nicotine" --> doShift "4:nicotine"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "2:www" | x <- my2Shifts]
, [className =? "Gimp" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "3:music" | x <- my3Shifts]
, [className =? "K3b" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShift "4:nicotine" | x <- my4Shifts]
, [className =? "tmw" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "5:misc" | x <- my5Shifts]
, [className =? "VirtualBox" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "6:gimp" | x <- my6Shifts]
, [className =? "Wine" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "7:mplayer" | x <- my7Shifts]
, [title =? "MusicBrainz Picard" --> doShift "5:misc"]
+
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "8:foo" | x <- my8Shifts]
  +
, [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "9:vbox" | x <- my9Shifts]
 
]
 
]
 
where
 
where
myCFloats = ["Ekiga", "Gimp", "MPlayer", "Nitrogen", "Nvidia-settings", "XCalc", "XFontSel", "Xmessage", "xmms"]
+
doShiftAndGo = doF . liftM2 (.) W.greedyView W.shift
  +
myCFloats = ["Ekiga", "MPlayer", "Nitrogen", "Nvidia-settings", "XCalc", "XFontSel", "Xmessage"]
 
myTFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
 
myTFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
 
myRFloats = []
 
myRFloats = []
  +
myIgnores = ["desktop_window", "kdesktop"]
  +
my1Shifts = []
  +
my2Shifts = ["Iceweasel"]
  +
my3Shifts = ["Gmpc"]
  +
my4Shifts = ["Nicotine"]
  +
my5Shifts = ["GQview", "Gconf-editor", "Gthumb", "OpenOffice.org 2.4"]
  +
my6Shifts = ["Gimp"]
  +
my7Shifts = ["MPlayer"]
  +
my8Shifts = ["K3b", "MusicBrainz Picard", "tmw"]
  +
my9Shifts = ["Virtual-Box", "Wine"]
   
 
-- dynamicLog pretty printer for dzen:
 
-- dynamicLog pretty printer for dzen:
 
myDzenPP h = defaultPP
 
myDzenPP h = defaultPP
{ ppCurrent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^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(" ++ myNormalFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppVisible = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^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!!
 
, 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 -> 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(" ++ myUrgentFGColor ++ ")^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 = " "
Line 217: Line 270:
 
"Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
 
"Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
 
"Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.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)"
 
_ -> x
 
_ -> x
 
)
 
)
 
, ppOutput = 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:nicotine", "5:misc"]
   
 
-- dynamicLog pretty printer for xmobar:
 
-- dynamicLog pretty printer for xmobar:
 
myXmobarPP h = defaultPP
 
myXmobarPP h = defaultPP
{ ppCurrent = wrap ("[<fc=" ++ myUrgentFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
{ ppCurrent = wrap ("[<fc=" ++ myUrgentFGColor ++ ">") "</fc>]" . \wsId -> dropIx wsId
, ppVisible = wrap ("[<fc=" ++ myNormalFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppVisible = wrap ("[<fc=" ++ myNormalFGColor ++ ">") "</fc>]" . \wsId -> dropIx wsId
, ppHidden = wrap "" "" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use <fc> here!!
+
, ppHidden = wrap "" "" . \wsId -> dropIx wsId -- don't use <fc> here!!
, ppHiddenNoWindows = wrap ("<fc=" ++ myDzenFGColor ++ ">") "</fc>" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
--, ppHiddenNoWindows = wrap ("<fc=" ++ myDzenFGColor ++ ">") "</fc>" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
, ppUrgent = wrap ("<fc=" ++ myUrgentFGColor ++ ">") "</fc>" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("<fc=" ++ myDzenFGColor ++ ">") "</fc>" . dropIx $ wsId
  +
, ppUrgent = wrap ("<fc=" ++ myUrgentFGColor ++ ">") "</fc>" . \wsId -> dropIx wsId
 
, ppSep = " "
 
, ppSep = " "
 
, ppWsSep = " "
 
, ppWsSep = " "
Line 237: Line 294:
 
"Hinted ResizableTall" -> "[|]"
 
"Hinted ResizableTall" -> "[|]"
 
"Hinted Mirror ResizableTall" -> "[-]"
 
"Hinted Mirror ResizableTall" -> "[-]"
  +
"Hinted combining Tabbed Bottom Simplest and Full with DragPane Vertical 0.1 0.8" -> "[/]"
 
_ -> x
 
_ -> x
 
)
 
)
 
, ppOutput = 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:nicotine", "5:misc"]
 
</haskell>
 
</haskell>
   

Revision as of 16:28, 6 November 2009

xmonad.hs

------------------------------------------------------------------------
-- ~/.xmonad/xmonad.hs
-- validate syntax: xmonad --recompile
------------------------------------------------------------------------
 
import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Actions.FloatKeys
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
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.ManageHook
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run
import XMonad.Util.WorkspaceCompare
import Control.Monad (liftM2)
import Data.Monoid
import Graphics.X11
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
  --xmobar <- spawnPipe myStatusBar
  dzen <- spawnPipe myStatusBar
  conkytop <- spawnPipe myTopBar
  conkympd <- spawnPipe myMPDBar
  conkyhdd <- spawnPipe myHDDBar
  dynHooksRef <- initDynamicHooks
  xmonad $ myUrgencyHook $ defaultConfig
 
    { terminal           = myTerminal
    , focusFollowsMouse  = myFocusFollowsMouse
    , borderWidth        = myBorderWidth
    , modMask            = myModMask
    , numlockMask        = myNumlockMask
    , workspaces         = myWorkspaces
    , normalBorderColor  = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
 
    , keys               = myKeys dynHooksRef
    , mouseBindings      = myMouseBindings
 
    , layoutHook         = myLayout
    , manageHook         = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
    , handleEventHook    = myEventHook
    , logHook            = dynamicLogWithPP $ myDzenPP dzen
    --, logHook          = dynamicLogWithPP $ myXmobarPP xmobar
    , startupHook        = myStartupHook
    }
 
myTerminal = "urxvt"
myFocusFollowsMouse = True
myBorderWidth = 1
myModMask = mod1Mask
myNumlockMask = mod2Mask
myWorkspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc", "6:gimp", "7:mplayer", "8:foo", "9:vbox"]
myNormalBorderColor = "#0f0f0f"
myFocusedBorderColor = "#1f1f1f"
 
myEventHook = mempty
--myLogHook = dynamicLogWithPP $ myDzenPP dzen
myStartupHook = return ()
 
-- Color, font and iconpath definitions:
--myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
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"
mySeperatorColor = "#555555"
 
-- XPConfig options:
myXPConfig = defaultXPConfig
    { font = "" ++ myFont ++ ""
    , bgColor = "" ++ myNormalBGColor ++ ""
    , fgColor = "" ++ myNormalFGColor ++ ""
    , fgHLight = "" ++ myNormalFGColor ++ ""
    , bgHLight = "" ++ myUrgentBGColor ++ ""
    , borderColor = "" ++ myFocusedBorderColor ++ ""
    , promptBorderWidth = 1
    , position = Bottom
    , height = 16
    , historySize = 100
    --, historyFilter = ""
    --, promptKeymap = ""
    --, completionKey = ""
    --, defaultText = ""
    --, autoComplete = "KeySym"
    --, showCompletionOnTab = ""
    }
 
-- Theme options:
myTheme = defaultTheme
    { activeColor = "" ++ myFocusedBGColor ++ ""
    , inactiveColor = "" ++ myDzenBGColor ++ ""
    , urgentColor = "" ++ myUrgentBGColor ++ ""
    , activeBorderColor = "" ++ myFocusedBorderColor ++ ""
    , inactiveBorderColor = "" ++ myNormalBorderColor ++ ""
    , urgentBorderColor = "" ++ myNormalBorderColor ++ ""
    , activeTextColor = "" ++ myFocusedFGColor ++ ""
    , inactiveTextColor = "" ++ myDzenFGColor ++ ""
    , urgentTextColor = "" ++ myUrgentFGColor ++ ""
    , fontName = "" ++ myFont ++ ""
    --, decoWidth = ""
    --, decoHeight = ""
    }
 
-- Statusbar options:
--myStatusBar = "xmobar"
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 $ (Full ||| resizableTile ||| Mirror resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    tabbedLayout = tabbedBottomAlways shrinkText myTheme
    gimpLayout = tabbedLayout ****||* Full
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100
 
-- Key bindings:
myKeys dynHooksRef conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((mod4Mask, xK_q), spawn "urxvt -e ssh and1@donnergurgler.net")
    , ((mod4Mask, xK_w), spawn "nitrogen --no-recurse --sort=alpha /home/and1/wallpapers/")
    , ((mod4Mask, xK_e), spawn "iceweasel")
    , ((mod4Mask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapDown . W.shiftMaster)) >> spawn "urxvt")
    , ((mod4Mask, xK_r), spawn "urxvt")
    , ((mod4Mask .|. shiftMask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt")
    , ((mod4Mask, xK_o), spawn "openoffice")
    , ((mod4Mask, xK_p), shellPrompt myXPConfig)
    , ((mod4Mask, xK_d), spawn "date +'%Y-%m-%d %H:%M' | osd_cat -p bottom -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
    , ((mod4Mask .|. shiftMask, xK_d), spawn "date +'%H:%M' | osd_cat -p middle -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
    , ((mod4Mask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 80x25+25+765")
    , ((mod4Mask .|. shiftMask, xK_f), oneShotHook dynHooksRef (className =? "URxvt") doFloat >> spawn "urxvt -g 140x10+25+975")
    , ((mod4Mask, xK_g), spawn "gimp")
    , ((mod4Mask, xK_k), spawn "k3b")
    , ((mod4Mask, xK_l), spawn "slock")
    , ((mod4Mask, xK_x), spawn "schroot -p gmpc")
    , ((mod4Mask, xK_v), spawn "virtualbox")
    , ((mod4Mask, xK_n), spawn "nicotine")
    , ((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_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_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 .|. shiftMask, xK_Tab), windows W.focusUp) -- move focus to the previous window
    , ((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 .|. shiftMask, xK_Left), withFocused (keysResizeWindow (-30,0) (0,0))) -- shrink floated window horizontally by 50 pixels
    --, ((modMask .|. shiftMask, xK_Right), withFocused (keysResizeWindow (30,0) (0,0))) -- expand floated window horizontally by 50 pixels
    --, ((modMask .|. shiftMask, xK_Up), withFocused (keysResizeWindow (-30,-30) (0,0))) -- shrink floated window by 50 pixels
    --, ((modMask .|. shiftMask, xK_Down), withFocused (keysResizeWindow (30,30) (0,0))) -- expand floated window by 50 pixels
    , ((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
    ]
    ++
    [ ((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 $
    [ [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) --> doShift "4:nicotine" | x <- my4Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "5:misc" | x <- my5Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "6:gimp" | x <- my6Shifts]
    , [(className =? x <||> title =? x <||> resource =? x) --> doShiftAndGo "7:mplayer" | 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", "XCalc", "XFontSel", "Xmessage"]
    myTFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
    myRFloats = []
    myIgnores = ["desktop_window", "kdesktop"]
    my1Shifts = []
    my2Shifts = ["Iceweasel"]
    my3Shifts = ["Gmpc"]
    my4Shifts = ["Nicotine"]
    my5Shifts = ["GQview", "Gconf-editor", "Gthumb", "OpenOffice.org 2.4"]
    my6Shifts = ["Gimp"]
    my7Shifts = ["MPlayer"]
    my8Shifts = ["K3b", "MusicBrainz Picard", "tmw"]
    my9Shifts = ["Virtual-Box", "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(" ++ myNormalBGColor ++ ")^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)"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }
    where
    dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
    staticWs = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
 
-- dynamicLog pretty printer for xmobar:
myXmobarPP h = defaultPP
    { ppCurrent = wrap ("[<fc=" ++ myUrgentFGColor ++ ">") "</fc>]" . \wsId -> dropIx wsId
    , ppVisible = wrap ("[<fc=" ++ myNormalFGColor ++ ">") "</fc>]" . \wsId -> dropIx wsId
    , ppHidden = wrap "" "" . \wsId -> dropIx wsId -- don't use <fc> here!!
    --, ppHiddenNoWindows = wrap ("<fc=" ++ myDzenFGColor ++ ">") "</fc>" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("<fc=" ++ myDzenFGColor ++ ">") "</fc>" . dropIx $ wsId
    , ppUrgent = wrap ("<fc=" ++ myUrgentFGColor ++ ">") "</fc>" . \wsId -> dropIx wsId
    , ppSep = " "
    , ppWsSep = " "
    , ppTitle = xmobarColor (""++ myNormalFGColor ++ "") "" . wrap "< " " >"
    , ppLayout = xmobarColor (""++ myDzenFGColor ++ "") "" .
        (\x -> case x of
        "Hinted Full" -> "[ ]"
        "Hinted ResizableTall" -> "[|]"
        "Hinted Mirror ResizableTall" -> "[-]"
        "Hinted combining Tabbed Bottom Simplest and Full with DragPane  Vertical 0.1 0.8" -> "[/]"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }
    where
    dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
    staticWs = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]


.xinitrc

xcompmgr &
xset -b b off
xrdb -load .Xdefaults
xmodmap -e "keysym Super_R = SunCompose"
xsetroot -cursor_name left_ptr
nitrogen --restore
nvidia-settings -a GlyphCache=1
nvidia-settings -a InitialPixmapPlacement=2
export OOO_FORCE_DESKTOP=gnome
exec /home/and1/bin/xmonad