diff options
author | Valery V. Vorotyntsev <valery.vv@gmail.com> | 2007-10-19 22:53:23 +0200 |
---|---|---|
committer | Valery V. Vorotyntsev <valery.vv@gmail.com> | 2007-10-19 22:53:23 +0200 |
commit | 74aa90f9ab8fe6a6be0b7492f2972c70f3e79678 (patch) | |
tree | 974bd6da7453d9dd88aef75dad2dd37f3a233d50 | |
parent | f00b4361f492839452e4669196c775ed7730dde1 (diff) | |
download | XMonadContrib-74aa90f9ab8fe6a6be0b7492f2972c70f3e79678.tar.gz XMonadContrib-74aa90f9ab8fe6a6be0b7492f2972c70f3e79678.tar.xz XMonadContrib-74aa90f9ab8fe6a6be0b7492f2972c70f3e79678.zip |
CycleWS.hs (toggleWS): new function
This is a pointfree adaptation of ViewPrev.viewPrev;
after this patch is applied, it may be a good idea to merge
ViewPrev.hs into CycleWS.hs.
darcs-hash:20071019205323-ae588-674d8f6229ab68d63cf7a324e3278408c569758c.gz
Diffstat (limited to '')
-rw-r--r-- | CycleWS.hs | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -20,6 +20,7 @@ module XMonadContrib.CycleWS ( prevWS, shiftToNext, shiftToPrev, + toggleWS, ) where import Control.Monad.State ( gets ) @@ -34,13 +35,14 @@ import {-# SOURCE #-} qualified Config (workspaces) -- $usage -- You can use this module with the following in your Config.hs file: --- +-- -- > import XMonadContrib.CycleWS -- -- > , ((modMask, xK_Right), nextWS) -- > , ((modMask, xK_Left), prevWS) -- > , ((modMask .|. shiftMask, xK_Right), shiftToNext) -- > , ((modMask .|. shiftMask, xK_Left), shiftToPrev) +-- > , ((modMask, xK_t), toggleWS) -- -- If you want to follow the moved window, you can use both actions: -- @@ -53,30 +55,29 @@ import {-# SOURCE #-} qualified Config (workspaces) -- %keybind , ((modMask, xK_Left), prevWS) -- %keybind , ((modMask .|. shiftMask, xK_Right), shiftToNext) -- %keybind , ((modMask .|. shiftMask, xK_Left), shiftToPrev) +-- %keybind , ((modMask, xK_t), toggleWS) --- --------------------- --- | --- Switch to next workspace -nextWS :: X() -nextWS = switchWorkspace (1) +-- | Switch to next workspace +nextWS :: X () +nextWS = switchWorkspace 1 --- --------------------- --- | --- Switch to previous workspace -prevWS :: X() +-- | Switch to previous workspace +prevWS :: X () prevWS = switchWorkspace (-1) --- | --- Move focused window to next workspace -shiftToNext :: X() -shiftToNext = shiftBy (1) +-- | Move focused window to next workspace +shiftToNext :: X () +shiftToNext = shiftBy 1 --- | --- Move focused window to previous workspace +-- | Move focused window to previous workspace shiftToPrev :: X () shiftToPrev = shiftBy (-1) +-- | Toggle to the workspace displayed previously +toggleWS :: X () +toggleWS = windows $ view =<< tag . head . hidden + switchWorkspace :: Int -> X () switchWorkspace d = wsBy d >>= windows . greedyView @@ -91,9 +92,8 @@ wsBy d = do let next = orderedWs !! ((now + d) `mod` length orderedWs) return $ tag next - wsIndex :: WindowSpace -> Maybe Int -wsIndex ws = findIndex (==(tag ws)) Config.workspaces +wsIndex ws = findIndex (== tag ws) Config.workspaces findWsIndex :: WindowSpace -> [WindowSpace] -> Maybe Int findWsIndex ws wss = findIndex ((== tag ws) . tag) wss |