Difference between revisions of "Xmonad/Config archive/skorpan's xmonad.hs"
< Xmonad | Config archive
Jump to navigation
Jump to search
(Updating.) |
(Updating.) |
||
Line 1: | Line 1: | ||
<haskell>import System.Exit |
<haskell>import System.Exit |
||
− | import System.IO (hPutStrLn) |
||
import XMonad |
import XMonad |
||
− | import XMonad.Actions.FindEmptyWorkspace |
||
− | import XMonad.Actions.FlexibleManipulate as Flex |
||
import XMonad.Hooks.DynamicLog |
import XMonad.Hooks.DynamicLog |
||
import XMonad.Hooks.ManageDocks |
import XMonad.Hooks.ManageDocks |
||
− | import XMonad.Hooks.UrgencyHook |
||
import XMonad.Layout.NoBorders |
import XMonad.Layout.NoBorders |
||
− | import XMonad. |
+ | import XMonad.Prompt (defaultXPConfig) |
− | import XMonad. |
+ | 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 |
||
Line 15: | Line 13: | ||
+ | myKeys c = mkKeymap c $ |
||
− | fontName = "'-*-fixed-medium-r-*-*-12-*-*-*-*-*-iso8859-*'" |
||
+ | [ ("M-<Return>", spawn $ XMonad.terminal c) |
||
− | dmenu = "exe=`cat /home/deniz/.programs | sort | dmenu -b -nb '#060000' -nf '#333333' -sb '#777777' -sf '#ffffff' -fn " ++ fontName ++ "` && eval \"exec $exe\"" |
||
+ | , ("M-<Space>", sendMessage NextLayout) |
||
− | myTerminal = "urxvtc" |
||
+ | , ("M-<Tab>", windows W.focusDown) |
||
− | myBorderWidth = 2 |
||
+ | , ("M-S-<Return>", windows W.swapMaster) |
||
− | myModMask = mod4Mask |
||
+ | , ("M-S-c", kill) |
||
− | myNumlockMask = mod2Mask |
||
+ | , ("M-S-q", io (exitWith ExitSuccess)) |
||
− | myWorkspaces = [ show x | x <- [1..9] ] |
||
+ | , ("M-b", sendMessage ToggleStruts) |
||
− | myNormalBorderColor = "#060000" |
||
+ | , ("M-h", sendMessage Shrink) |
||
− | myFocusedBorderColor = "#ff0000" |
||
+ | , ("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)) |
||
− | M.fromList $ |
||
− | + | , ((modMask, button2), (\w -> focus w >> windows W.swapMaster)) |
|
− | + | , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w)) |
|
+ | ] |
||
− | , ((modMask .|. shiftMask, xK_p ), spawn "gmrun") |
||
− | , ((modMask .|. shiftMask, xK_c ), kill) |
||
− | , ((modMask, xK_space ), sendMessage NextLayout) |
||
− | , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) |
||
− | , ((modMask, xK_n ), refresh) |
||
− | , ((modMask, xK_Left ), windows W.focusUp) |
||
− | , ((modMask, xK_Right ), windows W.focusDown) |
||
− | , ((modMask, xK_Tab ), windows W.focusDown) |
||
− | , ((modMask, xK_m ), viewEmptyWorkspace) |
||
− | , ((modMask .|. shiftMask, xK_j ), windows W.swapDown) |
||
− | , ((modMask .|. shiftMask, xK_k ), windows W.swapUp) |
||
− | , ((modMask .|. shiftMask, xK_Return ), windows W.swapMaster) |
||
− | , ((modMask, xK_F9 ), spawn "mpc prev") |
||
− | , ((modMask, xK_F10 ), spawn "mpc next") |
||
− | , ((modMask, xK_h ), sendMessage Shrink) |
||
− | , ((modMask, xK_l ), sendMessage Expand) |
||
− | , ((modMask, xK_t ), withFocused $ windows . W.sink) |
||
− | , ((modMask , xK_comma ), sendMessage (IncMasterN 1)) |
||
− | , ((modMask , xK_period ), sendMessage (IncMasterN (-1))) |
||
− | , ((modMask, xK_BackSpace ), focusUrgent) |
||
− | , ((modMask , xK_b ), sendMessage ToggleStruts) |
||
− | , ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) |
||
− | , ((modMask , xK_q ), broadcastMessage ReleaseResources >> restart "xmonad" True) |
||
− | ] |
||
− | ++ |
||
− | [((m .|. modMask, k), windows $ f i) |
||
− | | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] |
||
− | , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] |
||
− | ++ |
||
− | [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) |
||
− | | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] |
||
− | , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] |
||
+ | myLayoutHook = smartBorders $ avoidStruts $ tiled ||| Mirror tiled ||| Full |
||
− | myMouseBindings (XConfig {XMonad.modMask = modMask}) = |
||
+ | where |
||
− | M.fromList $ |
||
+ | tiled = Tall nmaster delta ratio |
||
− | [ ((modMask, button1), (\w -> focus w >> Flex.mouseWindow Flex.position w)) |
||
+ | nmaster = 1 |
||
− | , ((modMask, button3), (\w -> focus w >> Flex.mouseWindow Flex.resize w)) ] |
||
+ | ratio = 1/2 |
||
− | |||
+ | delta = 4/100 |
||
− | |||
− | myLayout = avoidStruts . smartBorders $ tall ||| Mirror tall ||| Full |
||
− | where |
||
− | tall = Tall nmaster delta ratio |
||
− | nmaster = 1 |
||
− | ratio = 1/2 |
||
− | delta = 1/100 |
||
myManageHook = composeAll |
myManageHook = composeAll |
||
[ floatC "MPlayer" |
[ floatC "MPlayer" |
||
− | , floatC " |
+ | , floatC "Gimp" |
− | , moveToC " |
+ | , moveToC "Conkeror" "2" |
− | , moveToC "Sonata" "9" |
||
] |
] |
||
− | <+> |
||
− | manageDocks |
||
where moveToC c w = className =? c --> doF (W.shift w) |
where moveToC c w = className =? c --> doF (W.shift w) |
||
moveToT t w = title =? t --> doF (W.shift w) |
moveToT t w = title =? t --> doF (W.shift w) |
||
Line 91: | Line 58: | ||
− | myLogHook |
+ | 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 |
+ | , ppLayout = \x -> case x of |
− | + | "Tall" -> "T" |
|
− | + | "Mirror Tall" -> "M" |
|
− | + | "Full" -> "F" |
|
+ | _ -> "?" |
||
+ | } |
||
+ | main = do xmobar <- spawnPipe "xmobar" |
||
− | firstDzenCommand = "dzen2 -fn " ++ fontName ++ " -bg '#060000' -fg '#777777' -h 16 -w 1280 -sa c -e '' -ta l" |
||
+ | xmonad $ defaultConfig { |
||
− | secondDzenCommand = "conky -u 1 | dzen2 -fn " ++ fontName ++ " -bg '#060000' -fg '#777777' -h 16 -w 1280 -sa c -e '' -ta r -y 784" |
||
+ | terminal = "urxvtc", |
||
− | |||
+ | focusFollowsMouse = True, |
||
− | |||
+ | borderWidth = 2, |
||
− | main = do din <- spawnPipe firstDzenCommand |
||
+ | modMask = mod4Mask, |
||
− | spawnPipe secondDzenCommand |
||
+ | numlockMask = 0, |
||
− | xmonad $ withUrgencyHook NoUrgencyHook |
||
− | + | workspaces = [ show x | x <- [1..9] ], |
|
− | + | normalBorderColor = "#444", |
|
− | + | focusedBorderColor = "#f00", |
|
− | + | keys = myKeys, |
|
− | + | mouseBindings = myMouseBindings, |
|
− | + | layoutHook = myLayoutHook, |
|
− | + | manageHook = myManageHook, |
|
− | + | logHook = myLogHook xmobar |
|
− | + | } |
|
− | keys = myKeys, |
||
− | mouseBindings = myMouseBindings, |
||
− | layoutHook = myLayout, |
||
− | manageHook = myManageHook, |
||
− | logHook = myLogHook din |
||
− | } |
||
</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
}