Skip to content

Instantly share code, notes, and snippets.

@reusee
Created April 3, 2012 07:39
Show Gist options
  • Save reusee/2290202 to your computer and use it in GitHub Desktop.
Save reusee/2290202 to your computer and use it in GitHub Desktop.
my xmonad configuration file
import XMonad
import Data.Monoid
import qualified Data.Map as M
import qualified XMonad.StackSet as W
import System.Exit
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
import XMonad.Util.Cursor
import XMonad.Util.SpawnOnce
import XMonad.Util.EZConfig
import qualified XMonad.Actions.FlexibleResize as Flex
import XMonad.Layout.NoBorders
-- 快捷键
myKeys = \conf -> mkKeymap conf $
[("M-<Return>", spawn $ XMonad.terminal conf)
,("M-<Space>", sendMessage NextLayout)
,("M-S-q", io (exitWith ExitSuccess))
,("M-q", spawn "xmonad --recompile; xmonad --restart")
,("M-y", spawn $ ("sudo " ++ (XMonad.terminal conf)))
,("M-p", spawn $ "dmenu_run")
,("M-[", sendMessage Shrink)
,("M-]", sendMessage Expand)
,("M-a", spawn $ (XMonad.terminal conf) ++ " -e 'vi /home/reus/.xmonad/xmonad.hs'")
,("M-h", prevWS)
,("M-S-h", shiftToPrev)
,("M-j", windows W.focusDown)
,("M-k", windows W.focusUp)
,("M-l", nextWS)
,("M-S-l", shiftToNext)
,("M-;", toggleWS)
,("M-z", kill)
,("M-n", windows W.swapDown)
,("M-m", goToSelected defaultGSConfig)
,("M-,", sendMessage (IncMasterN 1))
,("M-.", sendMessage (IncMasterN (-1)))
,("<XF86Back>", spawn $ "firefox")
,("<XF86Forward>", spawn $ "dbus-launch nautilus")
,("<XF86HomePage>", spawn $ "VBoxManage startvm xp")
,("<XF86Search>", spawn $ "sakura -e alsamixer")
,("<XF86Mail>", spawn $ "scrot")
]
-- 鼠标
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
[((modm, button1), (\w -> focus w >> mouseMoveWindow w))
,((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
]
-- 布局
myLayout = noBorders Full ||| tiled ||| Mirror tiled
where
tiled = Tall master delta ratio
master = 1
ratio = 1/2
delta = 3/100
-- 策略
myManageHook = composeAll
[className =? "MPlayer" --> doFloat
,resource =? "desktop_window" --> doIgnore
,resource =? "kdesktop" --> doIgnore
]
-- 启动
myStartupHook = do
setDefaultCursor xC_pirate
spawnOnce "ibus-daemon --xim -r -d"
spawnOnce "/home/reus/wuala/wuala -silent"
spawnOnce "/home/reus/script/potd.py"
--spawnOnce "cairo-compmgr"
-- 入口
main = xmonad defaultConfig
{terminal = "sakura"
, modMask = mod4Mask
, borderWidth = 1
, keys = myKeys
, layoutHook = myLayout
, manageHook = myManageHook
, handleEventHook = mempty
, logHook = return ()
, startupHook = myStartupHook
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment