public
Last active

xmonad.hs

  • Download Gist
xmonad.default
1 2 3 4 5 6 7
import XMonad
 
main = xmonad defaultConfig
{ modMask = mod4Mask -- Use Super instead of Alt
, terminal = "urxvt"
-- more changes
}
xmonad.hs
Haskell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
-- TODO: switch scratchpad terminal to Terminator
-- TODO: skip scratchpad workspace when using CycleWS
-- FIXME: Chrome bookmark pop up dialog
-- READ: http://www.haskell.org/haskellwiki/Xmonad/General_xmonad.hs_config_tips#Skipping_the_Scratchpad_workspace_while_using_CycleWS
import XMonad
import XMonad.Config.Gnome
import Control.Monad (liftM2)
 
import XMonad.Actions.CycleWindows
import XMonad.Actions.CycleWS
import XMonad.Actions.FlexibleResize
import XMonad.Actions.UpdatePointer
 
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageHelpers
 
import XMonad.Layout.NoBorders
import XMonad.Layout.ToggleLayouts
 
import qualified XMonad.StackSet as W
 
import XMonad.Util.EZConfig
--import XMonad.Util.Run
import XMonad.Util.Scratchpad
--import XMonad.Util.WorkspaceCompare
 
 
main = xmonad $ gnomeConfig {
borderWidth = 2,
normalBorderColor = "#222",
focusedBorderColor = "#c50",
focusFollowsMouse = False,
 
terminal = myTerminal,
modMask = mod4Mask,
 
workspaces = myWorkspaces,
logHook = updatePointer (Relative 0.5 0.5), --breaks Chrome bookmark dialog box
layoutHook = smartBorders (layoutHook gnomeConfig),
handleEventHook = fullscreenEventHook, --fix Chrome full screen
manageHook = myManageHook
}
`additionalKeysP` myKeys
-- `additionalMouseBindings` myMouseKeys
 
-- myExplorer = "nemo"
myTerminal = "terminator"
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
 
myKeys = [
("M4-u", spawn "xmonad --recompile; xmonad --restart"),
-- TODO(ting|2013-08-11): use variable
("C-M1-<Home>", spawn "nautilus"),
("M4-e", spawn "nautilus"),
("C-M1-t", spawn myTerminal),
-- TODO(ting|2013-08-11): replace quake terminal with Terminator
("M4-`", scratchpadSpawnActionCustom "gnome-terminal --disable-factory --name scratchpad"),
-- ("M4-b", spawn "chromium --allow-running-insecure-content"),
("M4-b", spawn "google-chrome"),
("M4-f", spawn "firefox"),
("M4-g", spawn "gcalctool"),
 
-- print screen
("<Print>", spawn "gnome-screenshot --interactive"),
("C-<Print>", spawn "gnome-screenshot -w"),
 
-- windows
("M1-q", kill),
("M1-<Tab>", cycleRecentWindows [xK_Alt_L] xK_Tab xK_Tab ), --classic alt-tab behavior
 
-- workspaces
("C-M1-h", prevWS),
("C-M1-l", nextWS),
("M1-`", toggleWS' ["NSP"]),
("C-S-h", shiftToPrev),
("C-S-l", shiftToNext),
("C-M1-S-h", shiftToPrev >> prevWS),
("C-M1-S-l", shiftToNext >> nextWS),
 
-- screens
("M1-S-<Tab>", shiftNextScreen),
("M4-<Tab>", nextScreen),
("M4-<Esc>", swapNextScreen)
] ++ [
-- switch to workspace as opposed to swapping
-- switch to workspace with C-M1- as opposed to M-
(otherModMasks ++ "C-M1-" ++ [key], action tag) |
(tag, key) <- zip myWorkspaces "123456789",
(otherModMasks, action) <- [ ("", windows . W.view), -- was W.greedyView
("S-", windows . W.shift) ]
]
-- where notNSP = (return $ ("NSP" /=) . W.tag) :: X (WindowSpace -> Bool)
-- -- | any workspace but scratchpad
-- shiftAndView dir = findWorkspace getSortByIndex dir (WSIs notNSP) 1
-- >>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t)
-- -- | hidden, non-empty workspaces less scratchpad
-- shiftAndView' dir = findWorkspace getSortByIndexNoSP dir HiddenNonEmptyWS 1
-- >>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t)
-- getSortByIndexNoSP =
-- fmap (.scratchpadFilterOutWorkspace) getSortByIndex
-- -- | toggle any workspace but scratchpad
-- myToggle = windows $ W.view =<< W.tag . head . filter
-- ((\x -> x /= "NSP" && x /= "SP") . W.tag) . W.hidden
 
-- myMouseKeys = [
-- allow mouse to resize
-- ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
-- ]
 
myManageHook = composeAll [
className =? "Eog" --> doFloat,
-- className =? "Gimp" --> doFloat,
-- className =? "Screenkey" --> doFloat,
className =? "Pasaffe" --> doFloat,
className =? "banshee" --> viewShift "9",
className =? "rhythmbox" --> viewShift "9",
 
className =? "Pidgin" --> viewShift "9",
className =? "Pidgin" --> doFloat,
 
-- Google Chat extension windows
appName =? "crx_nckgahadagoaajjgafhacjanaoiihapd" --> doShift "2",
appName =? "crx_nckgahadagoaajjgafhacjanaoiihapd" --> doFloat,
 
className =? "Do" --> doFloat,
 
title =? "Top Expanded Edge Panel" --> doIgnore,
title =? "Bottom Expanded Edge Panel" --> doIgnore,
resource =? "desktop_window" --> doIgnore,
isDialog --> doCenterFloat,
isFullscreen --> doFullFloat
] <+> manageScratchPad <+> manageHook defaultConfig
where viewShift = doF . liftM2 (.) W.view W.shift --shift workspace after move hook
 
-- ScratchPad customizations
manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)
where
h = 0.90 -- terminal height
w = 0.95 -- terminal width
t = 0.05 -- distance from top edge
l = 0.025 -- distance from left edge

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.