Xmonad/Config archive/skorpan's xmonad.hs
From HaskellWiki
(Difference between revisions)
(haskell tags) |
(Updating to new configuration.) |
||
| Line 30: | Line 30: | ||
import System.IO | import System.IO | ||
| - | dmenuExec = "exe=`dmenu_path | dmenu | + | dmenuExec = "exe=`dmenu_path | dmenu -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -b -nb '#000000' -nf '#FFFFFF' -sb '#000000'` && eval \"exec $exe\"" |
myIconsDir = "/home/deniz/usr/share/dzen2/icons" | myIconsDir = "/home/deniz/usr/share/dzen2/icons" | ||
| - | myStatusBar = "dzen2 | + | myStatusBar = "dzen2 -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -bg '#222222' -fg '#777777' -h 16 -w 1280 -sa c -e '' -ta l" |
| - | + | ||
main = do din <- spawnPipe myStatusBar | main = do din <- spawnPipe myStatusBar | ||
xmonad $ defaultConfig | xmonad $ defaultConfig | ||
{ borderWidth = 2 | { borderWidth = 2 | ||
| - | , normalBorderColor = "# | + | , normalBorderColor = "#000000" |
, focusedBorderColor = "#dddddd" | , focusedBorderColor = "#dddddd" | ||
, workspaces = | , workspaces = | ||
["1:main", "2:web", "3:dev"] ++ | ["1:main", "2:web", "3:dev"] ++ | ||
map show [4..7] ++ ["8:warez","9:music"] | map show [4..7] ++ ["8:warez","9:music"] | ||
| - | , terminal = " | + | , terminal = "urxvtc" |
, modMask = mod4Mask | , modMask = mod4Mask | ||
| - | , defaultGaps = [(16, | + | , defaultGaps = [(16,16,0,0)] |
| - | , manageHook = | + | , manageHook = myManageHook |
, logHook = dynamicLogWithPP $ myPP din | , logHook = dynamicLogWithPP $ myPP din | ||
, layoutHook = toggleLayouts (noBorders Full) $ | , layoutHook = toggleLayouts (noBorders Full) $ | ||
| - | smartBorders $ | + | -- smartBorders $ -- no borders if only window in ws (causes flickering) |
tiled ||| | tiled ||| | ||
Mirror tiled | Mirror tiled | ||
| Line 64: | Line 64: | ||
delta = 5%100 | delta = 5%100 | ||
| - | -- application control | + | -- application control |
-- | -- | ||
myManageHook :: ManageHook | myManageHook :: ManageHook | ||
| Line 72: | Line 72: | ||
, [ resource =? r --> doIgnore | r <- myIgnores] | , [ resource =? r --> doIgnore | r <- myIgnores] | ||
, [ className =? "Firefox-bin" --> doF (W.shift "2:web") ] | , [ className =? "Firefox-bin" --> doF (W.shift "2:web") ] | ||
| + | , [ className =? "Ktorrent" --> doF (W.shift "8:warez") ] | ||
| + | , [ className =? "Sonata" --> doF (W.shift "9:music") ] | ||
] | ] | ||
where | where | ||
| Line 77: | Line 79: | ||
myFloats = ["feh", | myFloats = ["feh", | ||
"GIMP", | "GIMP", | ||
| - | "gimp"] | + | "gimp", |
| + | "Pidgin", | ||
| + | "Dia"] | ||
myOtherFloats = ["Bon Echo Preferences", | myOtherFloats = ["Bon Echo Preferences", | ||
"Mail/News Preferences", | "Mail/News Preferences", | ||
| - | "Bon Echo - Restore Previous Session | + | "Bon Echo - Restore Previous Session"] |
| - | + | ||
-- modify/add default key binds | -- modify/add default key binds | ||
| Line 87: | Line 90: | ||
myKeys conf@(XConfig {modMask = modm}) = M.fromList $ | myKeys conf@(XConfig {modMask = modm}) = M.fromList $ | ||
[ ((modm, xK_p ), spawn dmenuExec) | [ ((modm, xK_p ), spawn dmenuExec) | ||
| + | -- wtf | ||
, ((modm, xK_x ), sendMessage ToggleLayout) | , ((modm, xK_x ), sendMessage ToggleLayout) | ||
, ((modm, xK_z ), toggleWS) | , ((modm, xK_z ), toggleWS) | ||
, ((modm, xK_Left ), windows W.focusUp) | , ((modm, xK_Left ), windows W.focusUp) | ||
| - | , ((modm, xK_Right ), windows W.focusDown) | + | , ((modm, xK_Right ), windows W.focusDown) |
, ((modm, xK_Up ), windows W.focusUp) | , ((modm, xK_Up ), windows W.focusUp) | ||
, ((modm, xK_Down ), windows W.focusDown) | , ((modm, xK_Down ), windows W.focusDown) | ||
| + | , ((modm, xK_e ), windows W.focusDown) | ||
| + | , ((modm, xK_o ), windows W.focusUp) | ||
, ((modm, xK_Return ), spawn $ XMonad.terminal conf) | , ((modm, xK_Return ), spawn $ XMonad.terminal conf) | ||
, ((modm .|. shiftMask, xK_Tab ), rotSlavesUp) | , ((modm .|. shiftMask, xK_Tab ), rotSlavesUp) | ||
| Line 98: | Line 104: | ||
, ((modm .|. shiftMask, xK_Left ), rotView False) | , ((modm .|. shiftMask, xK_Left ), rotView False) | ||
] | ] | ||
| - | + | ||
-- modify/add default mouse binds | -- modify/add default mouse binds | ||
| - | -- | + | -- |
myMouse (XConfig {modMask = modm}) = M.fromList $ | myMouse (XConfig {modMask = modm}) = M.fromList $ | ||
[ ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) | [ ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) | ||
| - | , ((modm, button4), (\_ -> rotView True)) | + | , ((modm, button4), (\_ -> rotView True)) |
, ((modm, button5), (\_ -> rotView False)) | , ((modm, button5), (\_ -> rotView False)) | ||
] | ] | ||
| Line 109: | Line 115: | ||
-- dynamiclog pretty printer for dzen | -- dynamiclog pretty printer for dzen | ||
-- ironic that this is "pretty printer" with such fugly code. | -- ironic that this is "pretty printer" with such fugly code. | ||
| - | myPP h = defaultPP | + | myPP h = defaultPP |
{ ppCurrent = wrap "^fg(#ffffff)^bg(#888888)^p(3)" "^p(2)^fg()^bg()" . \wsId -> | { ppCurrent = wrap "^fg(#ffffff)^bg(#888888)^p(3)" "^p(2)^fg()^bg()" . \wsId -> | ||
if (':' `elem` wsId) then | if (':' `elem` wsId) then | ||
| Line 142: | Line 148: | ||
, ppOutput = hPutStrLn h | , ppOutput = hPutStrLn h | ||
} | } | ||
| + | |||
</haskell> | </haskell> | ||
Revision as of 18:32, 8 February 2008
-- -- ~/.xmonad/xmonad.hs -- -- import the necessary libraries import XMonad import XMonad.ManageHook import XMonad.Operations import XMonad.Actions.CycleWS import XMonad.Actions.DwmPromote import XMonad.Actions.RotSlaves import XMonad.Actions.RotView import XMonad.Actions.SinkAll import XMonad.Hooks.DynamicLog ( PP(..), dynamicLogWithPP, dzenColor, wrap, defaultPP ) import XMonad.Hooks.UrgencyHook import XMonad.Layout.Grid import XMonad.Layout.Maximize import XMonad.Layout.NoBorders ( noBorders, smartBorders ) import XMonad.Layout.Tabbed import XMonad.Layout.ToggleLayouts import XMonad.Util.Run import qualified XMonad.StackSet as W import qualified XMonad.Actions.FlexibleResize as Flex import qualified Data.Map as M import Data.Bits ((.|.)) import Data.Ratio import Graphics.X11 import System.IO dmenuExec = "exe=`dmenu_path | dmenu -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -b -nb '#000000' -nf '#FFFFFF' -sb '#000000'` && eval \"exec $exe\"" myIconsDir = "/home/deniz/usr/share/dzen2/icons" myStatusBar = "dzen2 -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -bg '#222222' -fg '#777777' -h 16 -w 1280 -sa c -e '' -ta l" main = do din <- spawnPipe myStatusBar xmonad $ defaultConfig { borderWidth = 2 , normalBorderColor = "#000000" , focusedBorderColor = "#dddddd" , workspaces = ["1:main", "2:web", "3:dev"] ++ map show [4..7] ++ ["8:warez","9:music"] , terminal = "urxvtc" , modMask = mod4Mask , defaultGaps = [(16,16,0,0)] , manageHook = myManageHook , logHook = dynamicLogWithPP $ myPP din , layoutHook = toggleLayouts (noBorders Full) $ -- smartBorders $ -- no borders if only window in ws (causes flickering) tiled ||| Mirror tiled ||| Full ||| Grid ||| tabbed shrinkText defaultTConf ||| maximize (Tall 1 (3%100) (1%2)) , keys = \c -> myKeys c `M.union` keys defaultConfig c , mouseBindings = \c -> myMouse c `M.union` mouseBindings defaultConfig c } where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 50%100 delta = 5%100 -- application control -- myManageHook :: ManageHook myManageHook = composeAll . concat $ [ [ className =? c --> doFloat | c <- myFloats] , [ title =? t --> doFloat | t <- myOtherFloats] , [ resource =? r --> doIgnore | r <- myIgnores] , [ className =? "Firefox-bin" --> doF (W.shift "2:web") ] , [ className =? "Ktorrent" --> doF (W.shift "8:warez") ] , [ className =? "Sonata" --> doF (W.shift "9:music") ] ] where myIgnores = [] myFloats = ["feh", "GIMP", "gimp", "Pidgin", "Dia"] myOtherFloats = ["Bon Echo Preferences", "Mail/News Preferences", "Bon Echo - Restore Previous Session"] -- modify/add default key binds -- myKeys conf@(XConfig {modMask = modm}) = M.fromList $ [ ((modm, xK_p ), spawn dmenuExec) -- wtf , ((modm, xK_x ), sendMessage ToggleLayout) , ((modm, xK_z ), toggleWS) , ((modm, xK_Left ), windows W.focusUp) , ((modm, xK_Right ), windows W.focusDown) , ((modm, xK_Up ), windows W.focusUp) , ((modm, xK_Down ), windows W.focusDown) , ((modm, xK_e ), windows W.focusDown) , ((modm, xK_o ), windows W.focusUp) , ((modm, xK_Return ), spawn $ XMonad.terminal conf) , ((modm .|. shiftMask, xK_Tab ), rotSlavesUp) , ((modm .|. shiftMask, xK_Right ), rotView True) , ((modm .|. shiftMask, xK_Left ), rotView False) ] -- modify/add default mouse binds -- myMouse (XConfig {modMask = modm}) = M.fromList $ [ ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) , ((modm, button4), (\_ -> rotView True)) , ((modm, button5), (\_ -> rotView False)) ] -- dynamiclog pretty printer for dzen -- ironic that this is "pretty printer" with such fugly code. myPP h = defaultPP { ppCurrent = wrap "^fg(#ffffff)^bg(#888888)^p(3)" "^p(2)^fg()^bg()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppVisible = wrap "^bg(grey30)^fg(grey75)^p(2)" "^p(2)^fg()^bg()" , ppHidden = wrap "^fg(#ffffff)^bg()^p(2)" "^p(3)^fg()^bg()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppHiddenNoWindows = id . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId , ppSep = " ^fg(#ffffff)^r(2x2)^p(2)^fg() " , ppWsSep = " " , ppLayout = (\x -> case x of "Tall" -> " ^i(" ++ myIconsDir ++ "/tall.xbm) " "Mirror Tall" -> " ^i(" ++ myIconsDir ++ "/mtall.xbm) " "Full" -> " ^i(" ++ myIconsDir ++ "/full.xbm) " "Grid" -> " ^i(" ++ myIconsDir ++ "/grid.xbm) " "Tabbed" -> " ^i(" ++ myIconsDir ++ "/tabbed.xbm) " "Maximize Tall" -> " ^i(" ++ myIconsDir ++ "/maximize.xbm) " ) , ppTitle = dzenColor "white" "" , ppOutput = hPutStrLn h }
