Personal tools

Xmonad/Config archive/And1's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
m
m
Line 9: Line 9:
 
import XMonad hiding (Tall)
 
import XMonad hiding (Tall)
 
import XMonad.Actions.CycleWS
 
import XMonad.Actions.CycleWS
  +
import XMonad.Actions.FloatKeys
 
import XMonad.Hooks.DynamicHooks
 
import XMonad.Hooks.DynamicHooks
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.ManageDocks
 
import XMonad.Hooks.ManageDocks
 
import XMonad.Hooks.UrgencyHook
 
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.HintedTile
+
import XMonad.Layout.NoBorders
 
import XMonad.Layout.ResizableTile
 
import XMonad.Layout.ResizableTile
 
import XMonad.Layout.LayoutHints
 
import XMonad.Layout.LayoutHints
Line 30: Line 31:
   
 
main = do
 
main = do
dzen <- spawnPipe myStatusBar
+
dzen <- spawnPipe myStatusBar
dzentop <- spawnPipe myTopBar
+
dzentop <- spawnPipe myTopBar
dzenbottom <- spawnPipe myBottomBar
+
dzenbottom <- spawnPipe myBottomBar
dynHooksRef <- initDynamicHooks
+
dynHooksRef <- initDynamicHooks
xmonad $ myUrgencyHook $ defaultConfig
+
xmonad $ myUrgencyHook $ defaultConfig
   
{ terminal = "urxvt"
+
{ terminal = "urxvt"
, borderWidth = 1
+
, borderWidth = 1
, keys = myKeys dynHooksRef
+
, keys = myKeys dynHooksRef
, modMask = mod1Mask
+
, modMask = mod1Mask
, numlockMask = mod2Mask
+
, numlockMask = mod2Mask
, focusFollowsMouse = True
+
, focusFollowsMouse = True
, mouseBindings = myMouseBindings
+
, mouseBindings = myMouseBindings
, normalBorderColor = "#0f0f0f"
+
, normalBorderColor = "#0f0f0f"
, focusedBorderColor = "#0077cc"
+
, focusedBorderColor = "#0077cc"
, layoutHook = myLayout
+
, layoutHook = myLayout
, logHook = dynamicLogWithPP $ myDzenPP dzen
+
, logHook = dynamicLogWithPP $ myDzenPP dzen
, manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
+
, manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
, workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
+
, workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
}
+
}
  +
  +
-- Color, font and iconpath definitions:
  +
myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
  +
myIconDir = "/home/and1/.dzen"
  +
myDzenFGColor = "#555555"
  +
myDzenBGColor = ""
  +
myNormalFGColor = "#ffffff"
  +
myNormalBGColor = "#0f0f0f"
  +
myFocusedFGColor = "#f0f0f0"
  +
myFocusedBGColor = "#333333"
  +
myUrgentFGColor = "#0099ff"
  +
myUrgentBGColor = "#0077ff"
  +
myIconFGColor = "#777777"
  +
myIconBGColor = ""
  +
mySeperatorColor = "#555555"
   
 
-- Statusbar options:
 
-- Statusbar options:
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1320' -ta 'l' -fg '#f0f0f0' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
+
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1300' -ta 'l' -fg '" ++ myNormalFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myTopBar = "conky -c .conkytoprc | dzen2 -x '1320' -y '0' -h '16' -w '600' -ta 'r' -fg '#555555' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
+
myTopBar = "conky -c .conkytoprc | dzen2 -x '1300' -y '0' -h '16' -w '620' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myBottomBar = "conky -c .conkybottomrc | dzen2 -x '0' -y '1184' -h '16' -w '1920' -ta 'l' -fg '#555555' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
+
myBottomBar = "conky -c .conkybottomrc | dzen2 -x '0' -y '1184' -h '16' -w '1920' -ta 'l' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
   
 
-- Urgency hint options:
 
-- Urgency hint options:
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "#0099ff", "-bg", "#0f0f0f", "-fn", "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"] }
+
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1920", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
   
 
-- Layout options:
 
-- Layout options:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (Mirror resizableTile ||| resizableTile) $ (Full ||| hintedTile Wide ||| hintedTile Tall)
+
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (Mirror resizableTile ||| resizableTile) $ smartBorders (Full ||| Mirror resizableTile ||| resizableTile)
 
where
 
where
hintedTile = HintedTile nmaster delta ratio TopLeft
 
 
resizableTile = ResizableTall nmaster delta ratio []
 
resizableTile = ResizableTall nmaster delta ratio []
 
nmaster = 1
 
nmaster = 1
Line 71: Line 71:
 
-- XPConfig options:
 
-- XPConfig options:
 
myXPConfig = defaultXPConfig
 
myXPConfig = defaultXPConfig
{ font = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
+
{ font = "" ++ myFont ++ ""
, bgColor = "#222222"
+
, bgColor = "" ++ myFocusedBGColor ++ ""
, fgColor = "#ffffff"
+
, fgColor = "" ++ myNormalFGColor ++ ""
, fgHLight = "#ffffff"
+
, fgHLight = "" ++ myNormalFGColor ++ ""
, bgHLight = "#0066ff"
+
, bgHLight = "" ++ myUrgentBGColor ++ ""
, borderColor = "#ffffff"
+
, borderColor = "" ++ myNormalFGColor ++ ""
 
, promptBorderWidth = 1
 
, promptBorderWidth = 1
 
, position = Bottom
 
, position = Bottom
Line 94: Line 94:
 
, ((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_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 "schroot -p gmpc")
  +
, ((mod4Mask, xK_v), spawn "virtualbox")
 
, ((mod4Mask, xK_n), spawn "nicotine")
 
, ((mod4Mask, xK_n), spawn "nicotine")
 
, ((mod4Mask, xK_Print), spawn "scrot screen_%Y-%m-%d.png -d 1") -- take screenshot
 
, ((mod4Mask, xK_Print), spawn "scrot screen_%Y-%m-%d.png -d 1") -- take screenshot
Line 110: Line 113:
 
, ((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
 
, ((modMask, xK_period), sendMessage (IncMasterN (-1))) -- deincrement 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_space), focusUrgent) -- move focus to urgent window
 
, ((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 .|. 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
Line 116: Line 120:
 
, ((modMask .|. shiftMask, xK_k), 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_l), sendMessage Expand) -- expand the master area
 
, ((modMask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area
  +
, ((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_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" >> restart "xmonad" True) -- restart xmonad
Line 121: Line 129:
 
, ((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/wide
  +
, ((modMask .|. controlMask, xK_j), windows W.swapUp) -- swap the focused window with the previous window
  +
, ((modMask .|. controlMask, xK_k), windows W.swapDown) -- swap the focused window with the next window
 
, ((modMask .|. controlMask, xK_l), sendMessage MirrorShrink) -- shrink the height/wide
 
, ((modMask .|. controlMask, xK_l), sendMessage MirrorShrink) -- shrink the height/wide
 
, ((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_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
 
]
 
]
 
++
 
++
Line 152: Line 166:
 
, [className =? "Gmpc" --> doF (W.shift "3:music")]
 
, [className =? "Gmpc" --> doF (W.shift "3:music")]
 
, [className =? "Nicotine" --> doF (W.shift "4:nicotine")]
 
, [className =? "Nicotine" --> doF (W.shift "4:nicotine")]
  +
, [className =? "Gimp" --> doF (W.shift "5:misc")]
  +
, [className =? "VirtualBox" --> doF (W.shift "5:misc")]
  +
, [className =? "Wine" --> doF (W.shift "5:misc")]
 
]
 
]
 
where
 
where
myFloats = ["Ekiga", "Gimp", "gimp", "MPlayer", "Nitrogen", "Nvidia-settings", "Xmessage", "xmms"]
+
myFloats = ["Ekiga", "Gimp", "MPlayer", "Nitrogen", "Nvidia-settings", "XCalc", "XFontSel", "Xmessage", "xmms"]
 
myOtherFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
 
myOtherFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
 
myIgnores = []
 
myIgnores = []
Line 160: Line 177:
 
-- dynamicLog pretty printer for dzen:
 
-- dynamicLog pretty printer for dzen:
 
myDzenPP h = defaultPP
 
myDzenPP h = defaultPP
{ ppCurrent = wrap "^fg(#0099ff)^bg(#333333)^p()^i(/home/and1/.dzen/corner.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 -> if (':' `elem` wsId) then drop 2 wsId else wsId
, ppVisible = wrap "^fg(#ffffff)^bg(#333333)^p()^i(/home/and1/.dzen/corner.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 -> if (':' `elem` wsId) then drop 2 wsId else wsId
, ppHidden = wrap "^i(/home/and1/.dzen/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(#777777)^bg()^p()^i(/home/and1/.dzen/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 -> if (':' `elem` wsId) then drop 2 wsId else wsId
, ppUrgent = wrap "^fg(#0099ff)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppUrgent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg()^p()") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else 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 ResizableTall" -> "^fg(#777777)^i(/home/and1/.dzen/layout-tall-right.xbm)"
 
"Hinted Mirror ResizableTall" -> "^fg(#777777)^i(/home/and1/.dzen/layout-mirror-bottom.xbm)"
 
 
_ -> x
 
_ -> x
 
)
 
)
Line 180: Line 197:
 
-- dynamicLog pretty printer for xmobar:
 
-- dynamicLog pretty printer for xmobar:
 
myXmobarPP h = defaultPP
 
myXmobarPP h = defaultPP
{ ppCurrent = wrap "[<fc=#0099ff>" "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
{ ppCurrent = wrap ("[<fc=" ++ myUrgentFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
, ppVisible = wrap "[<fc=#ffffff>" "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
+
, ppVisible = wrap ("[<fc=" ++ myNormalFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
 
, ppHidden = wrap "" "" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use <fc> here!!
 
, ppHidden = wrap "" "" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use <fc> here!!
, ppHiddenNoWindows = wrap "<fc=#555555>" "</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=#0099ff>" "</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
 
, ppSep = " "
 
, ppSep = " "
 
, ppWsSep = " "
 
, ppWsSep = " "
, ppTitle = xmobarColor "#ffffff" "" . wrap "< " " >"
+
, ppTitle = xmobarColor (""++ myNormalFGColor ++ "") ""
, ppLayout = xmobarColor "#ffffff" "" .
+
, ppLayout = xmobarColor (""++ myNormalFGColor ++ "") "" .
 
(\x -> case x of
 
(\x -> case x of
"Hinted Tall" -> "[|]"
 
"Hinted Wide" -> "[-]"
 
 
"Hinted Full" -> "[ ]"
 
"Hinted Full" -> "[ ]"
 
"Hinted ResizableTall" -> "[|]"
 
"Hinted ResizableTall" -> "[|]"
Line 207: Line 222:
 
xcompmgr &
 
xcompmgr &
 
xset -b b off
 
xset -b b off
  +
xrdb -load .Xdefaults
 
xmodmap -e "keysym Super_R = SunCompose"
 
xmodmap -e "keysym Super_R = SunCompose"
xsetroot -cursor_name left_ptr
+
xsetroot -cursor_name left_ptr -solid "#0f0f0f"
nitrogen --restore
+
#nitrogen --restore
 
nvidia-settings -a GlyphCache=1
 
nvidia-settings -a GlyphCache=1
 
nvidia-settings -a InitialPixmapPlacement=2
 
nvidia-settings -a InitialPixmapPlacement=2

Revision as of 06:36, 4 February 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.UrgencyHook
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.LayoutHints
import XMonad.Layout.PerWorkspace
import XMonad.ManageHook
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run
import Graphics.X11
import System.Exit
import System.IO
 
import qualified Data.Map as M
import qualified XMonad.Actions.FlexibleResize as Flex
import qualified XMonad.StackSet as W
 
main = do
  dzen <- spawnPipe myStatusBar
  dzentop <- spawnPipe myTopBar
  dzenbottom <- spawnPipe myBottomBar
  dynHooksRef <- initDynamicHooks
  xmonad $ myUrgencyHook $ defaultConfig
 
    { terminal = "urxvt"
    , borderWidth = 1
    , keys = myKeys dynHooksRef
    , modMask = mod1Mask
    , numlockMask = mod2Mask
    , focusFollowsMouse = True
    , mouseBindings = myMouseBindings
    , normalBorderColor = "#0f0f0f"
    , focusedBorderColor = "#0077cc"
    , layoutHook = myLayout
    , logHook = dynamicLogWithPP $ myDzenPP dzen
    , manageHook = myManageHook <+> manageDocks <+> dynamicMasterHook dynHooksRef
    , workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
    }
 
-- Color, font and iconpath definitions:
myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
myIconDir = "/home/and1/.dzen"
myDzenFGColor = "#555555"
myDzenBGColor = ""
myNormalFGColor = "#ffffff"
myNormalBGColor = "#0f0f0f"
myFocusedFGColor = "#f0f0f0"
myFocusedBGColor = "#333333"
myUrgentFGColor = "#0099ff"
myUrgentBGColor = "#0077ff"
myIconFGColor = "#777777"
myIconBGColor = ""
mySeperatorColor = "#555555"
 
-- Statusbar options:
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1300' -ta 'l' -fg '" ++ myNormalFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myTopBar = "conky -c .conkytoprc | dzen2 -x '1300' -y '0' -h '16' -w '620' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
myBottomBar = "conky -c .conkybottomrc | dzen2 -x '0' -y '1184' -h '16' -w '1920' -ta 'l' -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 ++ ""] }
 
-- Layout options:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (Mirror resizableTile ||| resizableTile) $ smartBorders (Full ||| Mirror resizableTile ||| resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    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:
myKeys dynHooksRef conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((mod4Mask, xK_q), spawn "urxvt -g 120x40+20+30 -e ssh user@domain.net")
    , ((mod4Mask, xK_w), spawn "nitrogen --sort=alpha /home/and1/wallpapers/")
    , ((mod4Mask, xK_e), spawn "iceweasel")
    , ((mod4Mask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapDown . W.shiftMaster)) >> spawn "urxvt -g 120x40+20+30")
    , ((mod4Mask .|. shiftMask, xK_r), oneShotHook dynHooksRef (className =? "URxvt") (doF $ (W.swapUp . W.shiftMaster)) >> spawn "urxvt -g 120x40+20+30")
    , ((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_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_f), sendMessage NextLayout) -- rotate through the available layout algorithms
    , ((modMask, xK_j), windows W.focusUp) -- move focus to the previous window
    , ((modMask, xK_k), windows W.focusDown) -- move focus to the next 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_space), focusUrgent) -- move focus to urgent window
    , ((modMask, xK_Return), windows W.focusMaster) -- move focus to the master 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_j), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. shiftMask, xK_k), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area
    , ((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" >> restart "xmonad" True) -- 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/wide
    , ((modMask .|. controlMask, xK_j), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. controlMask, xK_k), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. controlMask, xK_l), sendMessage MirrorShrink) -- shrink the height/wide
    , ((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)) -- 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, 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 <- myFloats]
    , [title =? t --> doFloat | t <- myOtherFloats]
    , [resource =? r --> doFloat | r <- myIgnores]
    , [className =? "Iceweasel" --> doF (W.shift "2:www")]
    , [className =? "Gmpc" --> doF (W.shift "3:music")]
    , [className =? "Nicotine" --> doF (W.shift "4:nicotine")]
    , [className =? "Gimp" --> doF (W.shift "5:misc")]
    , [className =? "VirtualBox" --> doF (W.shift "5:misc")]
    , [className =? "Wine" --> doF (W.shift "5:misc")]
    ]
    where
    myFloats = ["Ekiga", "Gimp", "MPlayer", "Nitrogen", "Nvidia-settings", "XCalc", "XFontSel", "Xmessage", "xmms"]
    myOtherFloats = ["Downloads", "Iceweasel Preferences", "Save As..."]
    myIgnores = []
 
-- 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 -> 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 -> if (':' `elem` wsId) then drop 2 wsId else 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 -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppUrgent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg()^p()") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else 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)"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }
 
-- dynamicLog pretty printer for xmobar:
myXmobarPP h = defaultPP
    { ppCurrent = wrap ("[<fc=" ++ myUrgentFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppVisible = wrap ("[<fc=" ++ myNormalFGColor ++ ">") "</fc>]" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppHidden = wrap "" "" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use <fc> here!!
    , 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
    , ppSep = " "
    , ppWsSep = " "
    , ppTitle = xmobarColor (""++ myNormalFGColor ++ "") ""
    , ppLayout = xmobarColor (""++ myNormalFGColor ++ "") "" .
        (\x -> case x of
        "Hinted Full" -> "[ ]"
        "Hinted ResizableTall" -> "[|]"
        "Hinted Mirror ResizableTall" -> "[-]"
        _ -> x
        )
    , ppOutput = hPutStrLn h
    }


.xinitrc

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