Difference between revisions of "Xmonad/Config archive/skorpan's xmonad.hs"
< Xmonad | Config archive
Jump to navigation
Jump to search
(Updated for 0.7.) |
(Updating.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <haskell>import |
+ | <haskell>import System.Exit |
− | import |
+ | import XMonad |
import XMonad.Hooks.DynamicLog |
import XMonad.Hooks.DynamicLog |
||
import XMonad.Hooks.ManageDocks |
import XMonad.Hooks.ManageDocks |
||
− | import XMonad. |
+ | import XMonad.Layout.NoBorders |
− | import |
+ | import XMonad.Prompt (defaultXPConfig) |
+ | import XMonad.Prompt.Shell (shellPrompt) |
||
+ | import XMonad.Util.EZConfig |
||
+ | import XMonad.Util.Run |
||
import qualified XMonad.StackSet as W |
import qualified XMonad.StackSet as W |
||
import qualified Data.Map as M |
import qualified Data.Map as M |
||
− | dmenuExec = |
||
− | "exe=`dmenu_path | dmenu -b -nb black -nf white -sb gray -sf black` && eval \"exec $exe\"" |
||
− | myKeys |
+ | myKeys c = mkKeymap c $ |
− | + | [ ("M-<Return>", spawn $ XMonad.terminal c) |
|
− | + | , ("M-<Space>", sendMessage NextLayout) |
|
− | + | , ("M-<Tab>", windows W.focusDown) |
|
− | + | , ("M-S-<Return>", windows W.swapMaster) |
|
⚫ | |||
− | , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) |
||
− | + | , ("M-S-q", io (exitWith ExitSuccess)) |
|
− | + | , ("M-b", sendMessage ToggleStruts) |
|
− | + | , ("M-h", sendMessage Shrink) |
|
− | + | , ("M-l", sendMessage Expand) |
|
− | + | , ("M-n", refresh) |
|
− | + | , ("M-q", broadcastMessage ReleaseResources >> restart "xmonad" True) |
|
− | + | , ("M-t", withFocused $ windows . W.sink) |
|
− | + | , ("M-x", shellPrompt defaultXPConfig)] |
|
⚫ | |||
− | , ((modMask .|. shiftMask, xK_Return), windows W.swapMaster) |
||
− | + | [(m ++ k, windows $ f w) |
|
⚫ | |||
− | , ((modMask .|. shiftMask, xK_j ), windows W.swapDown ) |
||
− | + | , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] |
|
+ | |||
− | , ((modMask, xK_h ), sendMessage Shrink) |
||
− | , ((modMask, xK_l ), sendMessage Expand) |
||
− | , ((modMask, xK_t ), withFocused $ windows . W.sink) |
||
− | , ((modMask , xK_b ), sendMessage ToggleStruts) |
||
− | , ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) |
||
⚫ | |||
− | broadcastMessage ReleaseResources >> restart "xmonad" True) |
||
− | ] |
||
− | ++ |
||
− | [((m .|. modMask, k), windows $ f i) |
||
⚫ | |||
− | , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] |
||
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $ |
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $ |
||
Line 49: | Line 39: | ||
] |
] |
||
+ | |||
− | + | myLayoutHook = smartBorders $ avoidStruts $ tiled ||| Mirror tiled ||| Full |
|
where |
where |
||
− | + | tiled = Tall nmaster delta ratio |
|
nmaster = 1 |
nmaster = 1 |
||
ratio = 1/2 |
ratio = 1/2 |
||
− | delta = |
+ | delta = 4/100 |
+ | |||
myManageHook = composeAll |
myManageHook = composeAll |
||
− | + | [ floatC "MPlayer" |
|
− | + | , floatC "Gimp" |
|
⚫ | |||
− | , resource =? "desktop_window" --> doIgnore |
||
− | + | ] |
|
+ | where moveToC c w = className =? c --> doF (W.shift w) |
||
+ | moveToT t w = title =? t --> doF (W.shift w) |
||
+ | floatC c = className =? c --> doFloat |
||
⚫ | |||
− | ppCurrent = dzenColor "black" "white" . pad |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | , ppUrgent = dzenColor "red" "yellow" |
||
⚫ | |||
⚫ | |||
− | , ppLayout = dzenColor "white" "#333333" . |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | , ppTitle = ("^fg(white) " ++) . dzenEscape |
||
⚫ | |||
⚫ | |||
− | where |
||
− | icon h = "^i(/home/deniz/usr/share/dzen2/icons/" ++ h ++ ")" |
||
− | fill :: String -> Int -> String |
||
− | fill h i = "^p(" ++ show i ++ ")" ++ h ++ "^p(" ++ show i ++ ")" |
||
⚫ | |||
− | myStatusBar = "dzen2 -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*' -bg '#222222' -fg '#777777' -h 16 -w 1280 -sa c -e '' -ta l" |
||
⚫ | |||
+ | , ppTitle = xmobarColor "white" "" . shorten 110 |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | |||
− | main = do |
+ | main = do xmobar <- spawnPipe "xmobar" |
xmonad $ defaultConfig { |
xmonad $ defaultConfig { |
||
⚫ | |||
terminal = "urxvtc", |
terminal = "urxvtc", |
||
focusFollowsMouse = True, |
focusFollowsMouse = True, |
||
− | borderWidth = |
+ | borderWidth = 2, |
modMask = mod4Mask, |
modMask = mod4Mask, |
||
− | numlockMask = |
+ | numlockMask = 0, |
− | workspaces = [ |
+ | workspaces = [ show x | x <- [1..9] ], |
− | normalBorderColor = "# |
+ | normalBorderColor = "#444", |
− | focusedBorderColor = "# |
+ | focusedBorderColor = "#f00", |
− | |||
⚫ | |||
keys = myKeys, |
keys = myKeys, |
||
mouseBindings = myMouseBindings, |
mouseBindings = myMouseBindings, |
||
⚫ | |||
− | |||
− | -- hooks, layouts |
||
⚫ | |||
manageHook = myManageHook, |
manageHook = myManageHook, |
||
− | logHook = myLogHook |
+ | logHook = myLogHook xmobar |
} |
} |
||
</haskell> |
</haskell> |
Latest revision as of 17:28, 25 January 2009
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
import XMonad.Prompt (defaultXPConfig)
import XMonad.Prompt.Shell (shellPrompt)
import XMonad.Util.EZConfig
import XMonad.Util.Run
import qualified XMonad.StackSet as W
import qualified Data.Map as M
myKeys c = mkKeymap c $
[ ("M-<Return>", spawn $ XMonad.terminal c)
, ("M-<Space>", sendMessage NextLayout)
, ("M-<Tab>", windows W.focusDown)
, ("M-S-<Return>", windows W.swapMaster)
, ("M-S-c", kill)
, ("M-S-q", io (exitWith ExitSuccess))
, ("M-b", sendMessage ToggleStruts)
, ("M-h", sendMessage Shrink)
, ("M-l", sendMessage Expand)
, ("M-n", refresh)
, ("M-q", broadcastMessage ReleaseResources >> restart "xmonad" True)
, ("M-t", withFocused $ windows . W.sink)
, ("M-x", shellPrompt defaultXPConfig)]
++
[(m ++ k, windows $ f w)
| (w, k) <- zip (XMonad.workspaces c) (map show [1..9])
, (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]]
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
, ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
]
myLayoutHook = smartBorders $ avoidStruts $ tiled ||| Mirror tiled ||| Full
where
tiled = Tall nmaster delta ratio
nmaster = 1
ratio = 1/2
delta = 4/100
myManageHook = composeAll
[ floatC "MPlayer"
, floatC "Gimp"
, moveToC "Conkeror" "2"
]
where moveToC c w = className =? c --> doF (W.shift w)
moveToT t w = title =? t --> doF (W.shift w)
floatC c = className =? c --> doFloat
myLogHook xmobar = dynamicLogWithPP $ defaultPP {
ppOutput = hPutStrLn xmobar
, ppTitle = xmobarColor "white" "" . shorten 110
, ppCurrent = xmobarColor "white" "black" . pad
, ppHidden = pad
, ppHiddenNoWindows = \w -> xmobarColor "#444" "" (" " ++ w ++ " ")
, ppSep = xmobarColor "#555" "" " / "
, ppWsSep = ""
, ppLayout = \x -> case x of
"Tall" -> "T"
"Mirror Tall" -> "M"
"Full" -> "F"
_ -> "?"
}
main = do xmobar <- spawnPipe "xmobar"
xmonad $ defaultConfig {
terminal = "urxvtc",
focusFollowsMouse = True,
borderWidth = 2,
modMask = mod4Mask,
numlockMask = 0,
workspaces = [ show x | x <- [1..9] ],
normalBorderColor = "#444",
focusedBorderColor = "#f00",
keys = myKeys,
mouseBindings = myMouseBindings,
layoutHook = myLayoutHook,
manageHook = myManageHook,
logHook = myLogHook xmobar
}