2010-02-13 18:31:17 +01:00
|
|
|
import XMonad
|
|
|
|
import XMonad.Config.Desktop
|
|
|
|
import XMonad.Config.Gnome
|
|
|
|
import XMonad.Actions.CycleWS
|
|
|
|
import XMonad.Actions.NoBorders
|
2010-02-16 13:40:28 +01:00
|
|
|
import XMonad.Actions.PhysicalScreens
|
|
|
|
import XMonad.Actions.Warp
|
2010-02-13 18:31:17 +01:00
|
|
|
import XMonad.Hooks.ManageDocks
|
|
|
|
import XMonad.Hooks.ManageHelpers
|
2011-02-22 19:40:54 +01:00
|
|
|
import XMonad.Hooks.SetWMName
|
2010-02-16 11:45:32 +01:00
|
|
|
import XMonad.Layout.ResizableTile
|
2010-02-13 18:31:17 +01:00
|
|
|
import qualified XMonad.StackSet as W
|
|
|
|
import XMonad.Util.EZConfig
|
|
|
|
|
|
|
|
import Control.Monad
|
|
|
|
import Control.Monad.Trans
|
2011-02-22 19:40:54 +01:00
|
|
|
import Data.Maybe
|
2010-02-13 18:31:17 +01:00
|
|
|
import Data.Monoid
|
2010-02-16 13:40:28 +01:00
|
|
|
import Ratio((%))
|
2010-02-13 18:31:17 +01:00
|
|
|
|
2010-08-02 01:43:13 +02:00
|
|
|
--import ConfigurableBorders
|
2010-02-13 18:31:17 +01:00
|
|
|
import FullscreenManager
|
|
|
|
import NoBorders
|
2011-02-25 19:44:32 +01:00
|
|
|
import ProcessWorkspaces
|
2010-02-13 18:31:17 +01:00
|
|
|
|
|
|
|
|
2010-02-18 12:52:34 +01:00
|
|
|
modm = mod4Mask
|
2010-02-16 11:45:32 +01:00
|
|
|
|
2010-02-13 18:31:17 +01:00
|
|
|
main = xmonad $ gnomeConfig
|
2010-02-18 12:52:34 +01:00
|
|
|
{ modMask = modm
|
2010-02-13 18:31:17 +01:00
|
|
|
, manageHook = myManageHook
|
|
|
|
, layoutHook = desktopLayoutModifiers myLayoutHook
|
2011-02-22 19:40:54 +01:00
|
|
|
, startupHook = myStartupHook
|
2010-02-13 19:14:15 +01:00
|
|
|
, handleEventHook = myEventHook
|
2011-02-28 22:08:02 +01:00
|
|
|
, workspaces = myWorkspaces
|
2010-02-13 18:31:17 +01:00
|
|
|
}
|
2011-02-27 21:20:00 +01:00
|
|
|
`additionalKeysP` (
|
2010-02-16 11:45:32 +01:00
|
|
|
[ ("M-a", sendMessage MirrorShrink)
|
|
|
|
, ("M-y", sendMessage MirrorExpand)
|
|
|
|
, ("M-<Left>", prevWS)
|
|
|
|
, ("M-<Right>", nextWS)
|
|
|
|
, ("M-S-<Left>", shiftToPrev)
|
|
|
|
, ("M-S-<Right>", shiftToNext)
|
2010-02-13 18:31:17 +01:00
|
|
|
, ("M-S-b", withFocused toggleBorder >> refresh)
|
|
|
|
, ("M1-<F4>", kill)
|
2010-02-16 13:40:28 +01:00
|
|
|
, ("M-<F1>", viewOrWarp 0)
|
|
|
|
, ("M-<F2>", viewOrWarp 1)
|
|
|
|
, ("M-<F3>", viewOrWarp 2)
|
2011-02-27 16:18:48 +01:00
|
|
|
, ("M-b", banishScreen LowerRight)
|
2011-02-25 19:44:32 +01:00
|
|
|
, ("M-p", spawnOnCurrent "exe=`dmenu_path | /home/neoraider/bin/dmemu -b` && eval \"exec $exe\"")
|
2011-02-28 22:08:02 +01:00
|
|
|
]
|
|
|
|
++ [ (("M-" ++ show n, windows $ W.greedyView ws)) | (ws, n) <- zip myWorkspaces ([1..9]++[0])]
|
|
|
|
++ [ (("M-S-" ++ show n, shiftGroup ws)) | (ws, n) <- zip myWorkspaces ([1..9]++[0])]
|
|
|
|
++ [ (("M-C-" ++ show n, shiftIgnoreGroup ws)) | (ws, n) <- zip myWorkspaces ([1..9]++[0])]
|
2011-02-27 21:20:00 +01:00
|
|
|
)
|
2010-02-16 11:45:32 +01:00
|
|
|
`additionalMouseBindings`
|
2010-02-18 12:52:34 +01:00
|
|
|
[ ((modm, button4), \_ -> sendMessage Shrink)
|
|
|
|
, ((modm, button5), \_ -> sendMessage Expand)
|
|
|
|
, ((modm .|. shiftMask, button4), \_ -> sendMessage MirrorExpand)
|
|
|
|
, ((modm .|. shiftMask, button5), \_ -> sendMessage MirrorShrink)
|
2010-02-16 11:45:32 +01:00
|
|
|
]
|
2010-02-13 18:31:17 +01:00
|
|
|
|
|
|
|
|
2011-02-28 22:08:02 +01:00
|
|
|
myWorkspaces = ["Firefox", "Thunderbird", "Emacs", "4", "5", "6", "7", "8", "Chat", "10"]
|
|
|
|
|
|
|
|
|
2010-02-16 13:40:28 +01:00
|
|
|
viewOrWarp :: Int -> X ()
|
|
|
|
viewOrWarp n = do
|
2010-02-18 12:52:34 +01:00
|
|
|
wset <- gets windowset
|
2010-02-16 13:40:28 +01:00
|
|
|
i <- getScreen $ P n
|
|
|
|
whenJust i $ \s -> do
|
|
|
|
ws <- screenWorkspace s
|
|
|
|
whenJust ws $ \w -> windows . W.view $ w
|
|
|
|
when (s == (W.screen . W.current $ wset)) $ warpToScreen s (1%2) (1%2)
|
|
|
|
|
|
|
|
|
2010-08-02 01:43:13 +02:00
|
|
|
--myStartupHook :: X ()
|
|
|
|
--myStartupHook = do
|
|
|
|
-- startupHook gnomeConfig
|
|
|
|
-- spawn "killall -u `id -un` -q xcompmgr; exec xcompmgr"
|
2010-02-13 18:31:17 +01:00
|
|
|
|
2011-02-22 19:40:54 +01:00
|
|
|
myStartupHook :: X ()
|
|
|
|
myStartupHook = do
|
|
|
|
startupHook gnomeConfig
|
|
|
|
setWMName "LG3D"
|
|
|
|
|
|
|
|
|
2011-02-27 21:20:00 +01:00
|
|
|
atomProperty :: String -> Query Atom
|
|
|
|
atomProperty p = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap (fromMaybe 0) $ getAtomProperty d w p)
|
|
|
|
|
|
|
|
getAtomProperty :: Display -> Window -> String -> X (Maybe Atom)
|
|
|
|
getAtomProperty d w p = do
|
|
|
|
a <- getAtom p
|
|
|
|
md <- io $ getWindowProperty32 d a w
|
|
|
|
return $ fmap fromIntegral $ listToMaybe $ fromMaybe [] md
|
|
|
|
|
|
|
|
isUtility :: Query Bool
|
|
|
|
isUtility = do
|
|
|
|
atom__NET_WM_WINDOW_TYPE_UTILITY <- liftX $ getAtom "_NET_WM_WINDOW_TYPE_UTILITY"
|
|
|
|
atomProperty "_NET_WM_WINDOW_TYPE" =? atom__NET_WM_WINDOW_TYPE_UTILITY
|
|
|
|
|
|
|
|
|
2010-02-13 18:31:17 +01:00
|
|
|
myManageHook :: ManageHook
|
2011-02-23 17:45:27 +01:00
|
|
|
myManageHook = composeAll
|
2011-02-28 22:08:02 +01:00
|
|
|
[ isDialog --> doFloat
|
|
|
|
, composeOne
|
|
|
|
[ className =? "Guake.py" -?> (doFloatMaybeFullscreen <+> doIgnoreProcessWorkspace) -- <+> doConfigBorderOff)
|
2011-02-23 17:45:27 +01:00
|
|
|
--, className =? "Do" -?> (doFloat <+> doConfigBorderOff)
|
2011-02-26 04:21:44 +01:00
|
|
|
, className =? "Gmpc" -?> doIgnoreProcessWorkspace
|
|
|
|
, className =? "Liferea" -?> doIgnoreProcessWorkspace
|
2011-02-28 22:08:02 +01:00
|
|
|
, className =? "Gnome-session" -?> doIgnoreProcessWorkspace
|
2011-02-23 17:45:27 +01:00
|
|
|
, className =? "MPlayer" -?> doCenterFloat
|
|
|
|
, className =? "Gimp" -?> doFloat
|
|
|
|
, className =? "Display" -?> doFloat
|
|
|
|
, className =? "Wine" -?> doFloat
|
|
|
|
, className =? "Pcsx2" -?> doFloat
|
|
|
|
, stringProperty "WM_ICON_NAME" =? "ZeroGS" -?> doFloat
|
|
|
|
, isFullscreen -?> doFullscreen
|
|
|
|
]
|
2011-02-27 21:20:00 +01:00
|
|
|
, isUtility =? False --> doAutoShift
|
2011-02-23 17:45:27 +01:00
|
|
|
, manageHook gnomeConfig
|
|
|
|
]
|
2010-02-13 18:31:17 +01:00
|
|
|
|
|
|
|
|
2011-02-25 19:44:32 +01:00
|
|
|
myLayoutHook = processWorkspaceStorage $ manageFullscreen $ smartBorders (Full ||| tiled ||| Mirror tiled)
|
2010-02-13 18:31:17 +01:00
|
|
|
where
|
|
|
|
-- default tiling algorithm partitions the screen into two panes
|
2010-02-16 11:45:32 +01:00
|
|
|
tiled = ResizableTall nmaster delta ratio []
|
2010-02-13 18:31:17 +01:00
|
|
|
|
|
|
|
-- The default number of windows in the master pane
|
|
|
|
nmaster = 1
|
|
|
|
|
|
|
|
-- Default proportion of screen occupied by master pane
|
2010-02-16 11:45:32 +01:00
|
|
|
ratio = 3/5
|
2010-02-13 18:31:17 +01:00
|
|
|
|
|
|
|
-- Percent of screen to increment by when resizing panes
|
|
|
|
delta = 3/100
|
2010-02-13 19:14:15 +01:00
|
|
|
|
|
|
|
myEventHook :: Event -> X All
|
|
|
|
myEventHook ev = do
|
|
|
|
handleFullscreen ev
|
|
|
|
(handleEventHook gnomeConfig) ev
|