Created
October 15, 2010 05:36
-
-
Save squarehimself/627684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import System.Exit | |
import IO | |
import qualified Data.Map as M | |
import qualified XMonad.StackSet as W | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Util.Run | |
import XMonad.Layout.Combo | |
import XMonad.Layout.Dishes | |
import XMonad.Layout.Minimize | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.PerWorkspace | |
import XMonad.Layout.Reflect | |
import XMonad.Layout.ResizableTile | |
import XMonad.Layout.SimplestFloat | |
import XMonad.Layout.TwoPane | |
import XMonad.Layout.WindowNavigation | |
-------------------------------------- | |
-- Options | |
-- ------- | |
myBorderWidth = 1 | |
myModMask = mod1Mask | |
myNormalBorderColor = "#171717" | |
myFocusedBorderColor = "#a62424" | |
myTerminal = "urxvt" | |
myWorkspaces = ["main","etc","misc"] | |
-- Keybinds | |
-- -------- | |
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ | |
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) | |
, ((0, xK_F2 ), spawn $ XMonad.terminal conf) | |
, ((modm, xK_p ), spawn "dmenu_run -fn glisp -nb gray10 -nf gray70 -sb black -sf red") | |
, ((0, xK_F3 ), spawn "dmenu_run -fn glisp -nb gray10 -nf gray70 -sb black -sf red") | |
, ((modm .|. shiftMask, xK_p ), spawn "gmrun") | |
, ((modm .|. shiftMask, xK_c ), kill) | |
, ((modm, xK_space ), sendMessage NextLayout) | |
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) | |
, ((modm, xK_n ), refresh) | |
, ((modm, xK_Tab ), windows W.focusDown) | |
, ((modm, xK_j ), windows W.focusDown) | |
, ((modm, xK_k ), windows W.focusUp ) | |
, ((modm, xK_Return), windows W.swapMaster) | |
, ((modm .|. shiftMask, xK_j ), windows W.swapDown ) | |
, ((modm .|. shiftMask, xK_k ), windows W.swapUp ) | |
, ((modm, xK_h ), sendMessage Shrink) | |
, ((modm, xK_l ), sendMessage Expand) | |
, ((modm, xK_t ), withFocused $ windows . W.sink) | |
, ((modm, xK_comma ), sendMessage (IncMasterN 1)) | |
, ((modm, xK_period), sendMessage (IncMasterN (-1))) | |
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) | |
, ((modm, xK_q ), restart "xmonad" True) | |
, ((modm, xK_b ), sendMessage ToggleStruts) | |
, ((modm .|. shiftMask, xK_l ), sendMessage MirrorShrink) | |
, ((modm .|. shiftMask, xK_h ), sendMessage MirrorExpand) | |
, ((modm, xK_m ), withFocused minimizeWindow) | |
, ((modm .|. shiftMask, xK_m ), sendMessage RestoreNextMinimizedWin) | |
-- Manual Movements | |
-- ------ --------- | |
, ((modm .|. controlMask, xK_Right), sendMessage $ Move R) | |
, ((modm .|. controlMask, xK_Left ), sendMessage $ Move L) | |
, ((modm .|. controlMask, xK_Up ), sendMessage $ Move U) | |
, ((modm .|. controlMask, xK_Down ), sendMessage $ Move D) | |
-- Media keys | |
-- ----- ---- | |
, ((0 , 0x1008ff16), spawn "mpc -q prev") | |
, ((0 , 0x1008ff14), spawn "mpc -q toggle") | |
, ((0 , 0x1008ff17), spawn "mpc -q next") | |
, ((modm , 0x1008ff11), spawn "mpc -q volume -5") | |
, ((modm , 0x1008ff13), spawn "mpc -q volume +5") | |
, ((modm , 0x1008ff12), spawn "/home/square/bin/headphones.sh") | |
, ((0 , 0x1008ff12), spawn "ossvol -t") | |
, ((0 , 0x1008ff11), spawn "ossvol -d") | |
, ((0 , 0x1008ff13), spawn "ossvol -i") | |
, ((0 , 0x1008ff93), spawn "showbatt") | |
] | |
++ | |
[((m .|. modm, k), windows $ f i) | |
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | |
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] | |
++ | |
[((m .|. modm, 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)]] | |
-- Mouse | |
-- ----- | |
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)) | |
] | |
myFocusFollowsMouse :: Bool | |
myFocusFollowsMouse = True | |
-- Layouts | |
-- ------- | |
myLayout = minimize $ smartBorders $ avoidStruts (funkyhack ||| lays ||| windowNavigation (nethack)) | |
where | |
tiled = ResizableTall 1 (1/100) (147/227) [] | |
funkyhack = onWorkspace "etc" simplestFloat (tiled) | |
lays = reflectHoriz tiled ||| Mirror tiled ||| Full | |
nethack = (combineTwo (TwoPane (1/100) (147/227)) (Mirror (ResizableTall 1 (1/100) (3/4) [])) (Dishes 1 (1/6))) | |
-- Kludges | |
-- ------- | |
myManageHook = composeAll | |
[ className =? "MPlayer" --> doFloat | |
, className =? "Gimp" --> doFloat | |
, className =? "feh" --> doFloat | |
, className =? "Xmessage" --> doFloat | |
, resource =? "quickhack" --> doFloat | |
, resource =? "desktop_window" --> doIgnore | |
, isFullscreen --> doFullFloat ] | |
-- Empties | |
-- ------- | |
myLogHook = return () | |
myStartupHook = return () | |
-- XMobar PP | |
-- ------ -- | |
myPP :: PP | |
myPP = defaultPP | |
{ ppCurrent = xmobarColor "#a62424" "" | |
, ppSep = xmobarColor "#3a3a3a" "" " . " | |
, ppLayout = xmobarColor "#aa6868" "" | |
, ppUrgent = xmobarColor "red" "" | |
, ppTitle = xmobarColor "#acacab" "" . pad } | |
-- Get Ready | |
-- --- ----- | |
myconfig = defaultConfig { | |
terminal = myTerminal, | |
focusFollowsMouse = myFocusFollowsMouse, | |
borderWidth = myBorderWidth, | |
modMask = myModMask, | |
workspaces = myWorkspaces, | |
normalBorderColor = myNormalBorderColor, | |
focusedBorderColor = myFocusedBorderColor, | |
keys = myKeys, | |
mouseBindings = myMouseBindings, | |
layoutHook = myLayout, | |
manageHook = myManageHook, | |
logHook = myLogHook, | |
startupHook = myStartupHook | |
} | |
-- Make it rain | |
-- ---- -- ---- | |
main = do | |
xmonad myconfig | |
-- Don't use xmobar anymore. | |
-- xmobar <- spawnPipe "xmobar" | |
-- xmonad myconfig | |
-- { logHook = dynamicLogWithPP $ myPP { ppOutput = hPutStrLn xmobar } | |
-- } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment