Skip to content

Instantly share code, notes, and snippets.

Created July 16, 2012 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3122359 to your computer and use it in GitHub Desktop.
Save anonymous/3122359 to your computer and use it in GitHub Desktop.
xmonad
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.Util.Cursor
import XMonad.Util.SpawnOnce
import XMonad.Util.EZConfig
import qualified XMonad.Actions.FlexibleResize as Flex
import XMonad.Layout.NoBorders
import XMonad.Layout.ShowWName
import XMonad.Hooks.EwmhDesktops
import XMonad.Actions.WindowGo
import XMonad.Hooks.FadeWindows
-- 快捷键
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", spawn "mpick")
,("M-,", sendMessage (IncMasterN 1))
,("M-.", sendMessage (IncMasterN (-1)))
,("<XF86Back>", runOrRaise "firefox" (className =? "Firefox"))
,("<XF86Forward>", spawn $ "dbus-launch nautilus")
,("<XF86HomePage>", spawn $ "VBoxManage startvm xp")
--,("<XF86Search>", spawn $ "sakura -e alsamixer")
,("<XF86Search>", spawn $ "ossxmix")
,("<XF86Mail>", spawn $ "scrot")
,("M-<Left>", prevWS)
,("M-<Right>", nextWS)
]
mouseButtons =
[((mod4Mask .|. shiftMask, 5), const (nextWS))
,((mod4Mask .|. shiftMask, 4), const (prevWS))
,((mod4Mask, 4), const (windows W.focusUp))
,((mod4Mask, 5), const (windows W.focusDown))
]
-- 布局
myLayout = noBorders Full
||| tiled
||| Mirror tiled
where
tiled = Tall master delta ratio
master = 1
ratio = 1/2
delta = 3/100
-- 策略
myManageHook = composeAll . concat $
[[className =? c --> doFloat | c <- floatClasses]
,[title =? c --> doFloat | c <- floatTitles]
,[resource =? c --> doIgnore | c <- ignoreResources]
]
where
floatClasses = ["MPlayer", "Gimp"]
floatTitles = ["alsamixer"]
ignoreResources = ["desktop_window", "kdesktop"]
-- 启动
myStartupHook = do
setDefaultCursor xC_pirate
spawnOnce "ibus-daemon --xim -r -d"
--spawnOnce "fcitx -r -d"
spawnOnce "/home/reus/wuala/wuala -silent"
spawnOnce "/home/reus/script/potd.py"
spawnOnce "python2 /home/reus/goagent/local/proxy.py"
spawnOnce "firefox"
--spawnOnce "xcompmgr -cfFD 5"
-- 入口
main = xmonad $ ewmh defaultConfig
{terminal = "sakura"
, modMask = mod4Mask
, borderWidth = 1
, keys = myKeys
, layoutHook = showWName myLayout
, manageHook = myManageHook
, handleEventHook = fadeWindowsEventHook
, logHook = fadeWindowsLogHook myFadeHook
, startupHook = myStartupHook
}
`additionalMouseBindings` mouseButtons
myFadeHook = composeAll [isUnfocused --> transparency 0.2, opaque]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment