From c00ae76a705354900f503ed85a6c9fe7cd938620 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Feb 2010 13:40:28 +0100 Subject: Added screen switching --- xmonad.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xmonad.hs b/xmonad.hs index be1d1e9..06a4978 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -3,6 +3,8 @@ import XMonad.Config.Desktop import XMonad.Config.Gnome import XMonad.Actions.CycleWS import XMonad.Actions.NoBorders +import XMonad.Actions.PhysicalScreens +import XMonad.Actions.Warp import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Layout.ResizableTile @@ -12,6 +14,7 @@ import XMonad.Util.EZConfig import Control.Monad import Control.Monad.Trans import Data.Monoid +import Ratio((%)) import ConfigurableBorders import FullscreenManager @@ -36,6 +39,9 @@ main = xmonad $ gnomeConfig , ("M-S-", shiftToNext) , ("M-S-b", withFocused toggleBorder >> refresh) , ("M1-", kill) + , ("M-", viewOrWarp 0) + , ("M-", viewOrWarp 1) + , ("M-", viewOrWarp 2) ] `additionalMouseBindings` [ ((myModMask, button4), \_ -> sendMessage Shrink) @@ -45,6 +51,16 @@ main = xmonad $ gnomeConfig ] +viewOrWarp :: Int -> X () +viewOrWarp n = do + XState {windowset = wset} <- get + 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) + + myStartupHook :: X () myStartupHook = do startupHook gnomeConfig -- cgit v1.2.3