Difference between revisions of "Xmonad/Config archive/And1's xmonad.hs"

From HaskellWiki
Jump to navigation Jump to search
m
Line 2: Line 2:
 
------------------------------------------------------------------------
 
------------------------------------------------------------------------
 
-- ~/.xmonad/xmonad.hs
 
-- ~/.xmonad/xmonad.hs
-- validate syntax: $ ghci ~/.xmonad/xmonad.hs
+
-- validate syntax: xmonad --recompile
 
------------------------------------------------------------------------
 
------------------------------------------------------------------------
   
Line 17: Line 17:
 
import XMonad.Prompt.Shell
 
import XMonad.Prompt.Shell
 
import XMonad.Util.Run
 
import XMonad.Util.Run
  +
import Graphics.X11
 
import System.Exit
 
import System.Exit
 
import System.IO
 
import System.IO
Line 31: Line 32:
 
xmonad $ myUrgencyHook $ defaultConfig
 
xmonad $ myUrgencyHook $ defaultConfig
   
{ normalBorderColor = "#222222"
+
{ normalBorderColor = "#0f0f0f"
 
, focusedBorderColor = "#0077cc"
 
, focusedBorderColor = "#0077cc"
 
, terminal = "urxvt"
 
, terminal = "urxvt"
Line 43: Line 44:
 
, mouseBindings = myMouseBindings
 
, mouseBindings = myMouseBindings
 
, borderWidth = 1
 
, borderWidth = 1
, logHook = dynamicLogWithPP $ myLogHook din
+
, logHook = dynamicLogWithPP $ myDzenPP din
 
, focusFollowsMouse = True
 
, focusFollowsMouse = True
 
}
 
}
   
 
-- Statusbar options:
 
-- Statusbar options:
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'"
+
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1000' -ta 'l' -fg '#f0f0ff' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
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'"
+
myTopBar = "conky -c .conkytoprc | dzen2 -x '1000' -y '0' -h '16' -w '600' -ta 'r' -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 '1600' -ta 'l' -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 '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
   
 
-- Urgency hint options:
 
-- Urgency hint options:
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
{ 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"] }
+
{ args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1600", "-ta", "r", "-expand", "l", "-fg", "#0099ff", "-bg", "#0f0f0f", "-fn", "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"] }
   
 
-- Layout options:
 
-- Layout options:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (hintedTile Wide) $ onWorkspaces ["2:www","3:music","4:nicotine"] (Full) $ (hintedTile Tall ||| hintedTile Wide ||| Full)
+
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (hintedTile Wide ||| hintedTile Tall) $ (Full ||| hintedTile Wide ||| hintedTile Tall)
 
where
 
where
 
hintedTile = HintedTile nmaster delta ratio TopLeft
 
hintedTile = HintedTile nmaster delta ratio TopLeft
Line 80: Line 81:
 
-- 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 -g 120x40+20+30 -e ssh user@host.net")
 
, ((mod4Mask, xK_e), spawn "iceweasel")
 
, ((mod4Mask, xK_e), spawn "iceweasel")
 
, ((mod4Mask, xK_r), spawn "urxvt -g 120x40+20+30")
 
, ((mod4Mask, xK_r), spawn "urxvt -g 120x40+20+30")
Line 89: Line 90:
 
, ((mod4Mask, xK_x), spawn "schroot -p gmpc")
 
, ((mod4Mask, xK_x), spawn "schroot -p gmpc")
 
, ((mod4Mask, xK_n), spawn "nicotine")
 
, ((mod4Mask, xK_n), spawn "nicotine")
, ((mod4Mask, xK_Print), spawn "scrot desk_%Y-%m-%d.png -d 1") -- take screenshot
+
, ((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
Line 116: Line 117:
 
++
 
++
 
[ ((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
 
]
 
]
 
++
 
++
 
[ ((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)) -- 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.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, 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
 
]
 
]
   
Line 145: Line 146:
 
where
 
where
 
myFloats = ["ekiga", "Gimp", "gimp", "MPlayer", "Nitrogen", "Transmission-gtk", "Xmessage", "xmms"]
 
myFloats = ["ekiga", "Gimp", "gimp", "MPlayer", "Nitrogen", "Transmission-gtk", "Xmessage", "xmms"]
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"]
+
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", "Exit", "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"]
 
myIgnores = []
 
myIgnores = []
   
 
-- 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(#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
, 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(#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
, 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(/home/and1/.dzen/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(#777777)^bg()^p()^i(/home/and1/.dzen/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(#0099ff)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
 
, ppSep = " "
 
, ppSep = " "
Line 163: Line 164:
 
"Hinted Wide" -> "^fg(#777777)^i(/home/and1/.dzen/layout-mirror-bottom.xbm)"
 
"Hinted Wide" -> "^fg(#777777)^i(/home/and1/.dzen/layout-mirror-bottom.xbm)"
 
"Hinted Full" -> "^fg(#777777)^i(/home/and1/.dzen/layout-full.xbm)"
 
"Hinted Full" -> "^fg(#777777)^i(/home/and1/.dzen/layout-full.xbm)"
  +
)
  +
, ppOutput = System.IO.UTF8.hPutStrLn h
  +
}
  +
  +
-- dynamicLog pretty printer for xmobar:
  +
myXmobarPP h = defaultPP
  +
{ ppCurrent = wrap "[<fc=#0099ff>" "</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
  +
, 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
  +
, ppUrgent = wrap " <fc=#0099ff>" "</fc> " . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
  +
, ppSep = " "
  +
, ppWsSep = " "
  +
, ppTitle = xmobarColor "#ffffff" "" . wrap "< " " >"
  +
, ppLayout = xmobarColor "#ffffff" "" .
  +
(\x -> case x of
  +
"Hinted Tall" -> "[|]"
  +
"Hinted Wide" -> "[-]"
  +
"Hinted Full" -> "[ ]"
 
)
 
)
 
, ppOutput = System.IO.UTF8.hPutStrLn h
 
, ppOutput = System.IO.UTF8.hPutStrLn h

Revision as of 15:42, 30 September 2008

------------------------------------------------------------------------
-- ~/.xmonad/xmonad.hs
-- validate syntax: xmonad --recompile
------------------------------------------------------------------------

import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.HintedTile
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 System.IO.UTF8
import qualified XMonad.Actions.FlexibleResize as Flex
import qualified XMonad.StackSet as W

main = do
    din <- spawnPipe myStatusBar
    din2 <- spawnPipe myTopBar
    din3 <- spawnPipe myBottomBar
    xmonad $ myUrgencyHook $ defaultConfig

       { normalBorderColor = "#0f0f0f"
       , focusedBorderColor = "#0077cc"
       , terminal = "urxvt"
       , layoutHook = myLayout
       , manageHook = myManageHook <+> manageDocks
       , workspaces = ["1:irc", "2:www", "3:music", "4:nicotine", "5:misc"]
       --, workspaces = ["1:irc", "2:www", "3:music"] ++ map show [4..9]
       , numlockMask = mod2Mask
       , modMask = mod1Mask
       , keys = myKeys
       , mouseBindings = myMouseBindings
       , borderWidth = 1
       , logHook = dynamicLogWithPP $ myDzenPP din
       , focusFollowsMouse = True
       }

-- Statusbar options:
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1000' -ta 'l' -fg '#f0f0ff' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
myTopBar = "conky -c .conkytoprc | dzen2 -x '1000' -y '0' -h '16' -w '600' -ta 'r' -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 '1600' -ta 'l' -fg '#555555' -bg '#0f0f0f' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"

-- Urgency hint options:
myUrgencyHook = withUrgencyHook dzenUrgencyHook
    { args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1600", "-ta", "r", "-expand", "l", "-fg", "#0099ff", "-bg", "#0f0f0f", "-fn", "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"] }

-- Layout options:
myLayout = avoidStruts $ layoutHints $ onWorkspace "1:irc" (hintedTile Wide ||| hintedTile Tall) $ (Full ||| hintedTile Wide ||| hintedTile Tall)
    where
    hintedTile = HintedTile nmaster delta ratio TopLeft
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100

-- XPConfig options:
myXPConfig = defaultXPConfig
    { font = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
    , bgColor = "#222222"
    , fgColor = "#ffffff"
    , fgHLight = "#ffffff"
    , bgHLight = "#0066ff"
    , borderColor = "#ffffff"
    , promptBorderWidth = 1
    , position = Bottom
    , height = 16
    , historySize = 100
    }

-- Key bindings:
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((mod4Mask, xK_q), spawn "urxvt -g 120x40+20+30 -e ssh user@host.net")
    , ((mod4Mask, xK_e), spawn "iceweasel")
    , ((mod4Mask, xK_r), spawn "urxvt -g 120x40+20+30")
    , ((mod4Mask, xK_t), spawn "icedove")
    , ((mod4Mask, xK_o), spawn "openoffice")
    , ((mod4Mask, xK_p), shellPrompt myXPConfig)
    , ((mod4Mask, xK_l), spawn "slock")
    , ((mod4Mask, xK_x), spawn "schroot -p gmpc")
    , ((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_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_Return), windows W.focusMaster) -- move focus to the master window
    , ((modMask, xK_Up), windows W.focusUp) -- move focus to the previous window
    , ((modMask, xK_Down), windows W.focusDown) -- move focus to the next 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_Down), sendMessage Expand) -- expand the master area
    , ((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_x), kill) -- close focused window
    , ((modMask .|. controlMask, xK_Left), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. controlMask, xK_Right), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. controlMask, xK_Up), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
    , ((modMask .|. controlMask, xK_Down), sendMessage (IncMasterN (-1))) -- deincrement the number of windows in the master area
    ]
    ++
    [ ((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 =? "Firefox-bin" --> doF (W.shift "2:www")]
    , [className =? "Gmpc" --> doF (W.shift "3:music")]
    , [className =? "Nicotine" --> doF (W.shift "4:nicotine")]
    ]
    where
    myFloats = ["ekiga", "Gimp", "gimp", "MPlayer", "Nitrogen", "Transmission-gtk", "Xmessage", "xmms"]
    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", "Exit", "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"]
    myIgnores = []

-- dynamicLog pretty printer for dzen:
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
    , 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
    , 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!!
    , 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
    , ppUrgent = wrap "^fg(#0099ff)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppSep = " "
    , ppWsSep = " "
    , ppTitle = dzenColor "#ffffff" "" . wrap "< " " >"
    , ppLayout = dzenColor "#ffffff" "" .
        (\x -> case x of
        "Hinted Tall" -> "^fg(#777777)^i(/home/and1/.dzen/layout-tall-right.xbm)"
        "Hinted Wide" -> "^fg(#777777)^i(/home/and1/.dzen/layout-mirror-bottom.xbm)"
        "Hinted Full" -> "^fg(#777777)^i(/home/and1/.dzen/layout-full.xbm)"
        )
    , ppOutput = System.IO.UTF8.hPutStrLn h
    }

-- dynamicLog pretty printer for xmobar:
myXmobarPP h = defaultPP
    { ppCurrent = wrap "[<fc=#0099ff>" "</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
    , 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
    , ppUrgent = wrap " <fc=#0099ff>" "</fc> " . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
    , ppSep = " "
    , ppWsSep = " "
    , ppTitle = xmobarColor "#ffffff" "" . wrap "< " " >"
    , ppLayout = xmobarColor "#ffffff" "" .
        (\x -> case x of
        "Hinted Tall" -> "[|]"
        "Hinted Wide" -> "[-]"
        "Hinted Full" -> "[ ]"
        )
    , ppOutput = System.IO.UTF8.hPutStrLn h
    }