|
-- 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 |