aboutsummaryrefslogtreecommitdiffstats
path: root/NextWorkspace.hs
diff options
context:
space:
mode:
authormail <mail@joachim-breitner.de>2007-10-07 12:39:33 +0200
committermail <mail@joachim-breitner.de>2007-10-07 12:39:33 +0200
commit6a386110616c2156847ae575f787e494de1dff8a (patch)
tree08b9aa42921389cc01a006c428efc3f05e31ab75 /NextWorkspace.hs
parent802450ed9fa6c5fd2e0a27f398cc01dcd5a1c864 (diff)
downloadXMonadContrib-6a386110616c2156847ae575f787e494de1dff8a.tar.gz
XMonadContrib-6a386110616c2156847ae575f787e494de1dff8a.tar.xz
XMonadContrib-6a386110616c2156847ae575f787e494de1dff8a.zip
Move my NextWorkspace functionality into CycleWS
Hi, This patch merges the additional functionality of my NextWorkspace into CycleWS, using a compatible interface for what was there before. Greetings, Joachim darcs-hash:20071007103933-c9905-c5cfc7d03abbeddf78631deee384583d15015801.gz
Diffstat (limited to '')
-rw-r--r--NextWorkspace.hs97
1 files changed, 0 insertions, 97 deletions
diff --git a/NextWorkspace.hs b/NextWorkspace.hs
deleted file mode 100644
index ae4f594..0000000
--- a/NextWorkspace.hs
+++ /dev/null
@@ -1,97 +0,0 @@
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.NextWorkspace
--- Copyright : (c) Joachim Breitner <mail@joachim-breitner.de>
--- License : BSD3-style (see LICENSE)
---
--- Maintainer : Joachim Breitner <mail@joachim-breitner.de>
--- Stability : unstable
--- Portability : unportable
---
--- Provides bindings to cycle forward or backward through the list
--- of workspaces, and to move windows there.
---
------------------------------------------------------------------------------
-
-module XMonadContrib.NextWorkspace (
- -- * Usage
- -- $usage
- nextWorkspace,
- prevWorkspace,
- shiftToNext,
- shiftToPrev,
- ) where
-
-import Control.Monad.State ( gets )
-import Data.List ( sortBy, findIndex )
-import Data.Maybe ( fromMaybe )
-import Data.Ord ( comparing )
-
-import XMonad
-import StackSet hiding (filter, findIndex)
-import Operations
-import {-# SOURCE #-} qualified Config (workspaces)
-
--- $usage
--- You can use this module with the following in your Config.hs file:
---
--- > import XMonadContrib.NextWorkspace
---
--- > , ((modMask, xK_Right), nextWorkspace)
--- > , ((modMask, xK_Left), prevWorkspace)
--- > , ((modMask .|. shiftMask, xK_Right), shiftToNext)
--- > , ((modMask .|. shiftMask, xK_Left), shiftToPrev)
---
--- If you want to follow the moved window, you can use both actions:
---
--- > , ((modMask .|. shiftMask, xK_Right), shiftToNext >> nextWorkspace)
--- > , ((modMask .|. shiftMask, xK_Left), shiftToPrev >> prevWorkspace)
---
-
--- %import XMonadContrib.RotView
--- %keybind , ((modMask .|. shiftMask, xK_Right), rotView True)
--- %keybind , ((modMask .|. shiftMask, xK_Left), rotView False)
-
-
--- ---------------------
--- |
--- Switch to next workspace
-nextWorkspace :: X()
-nextWorkspace = switchWorkspace (1)
-
--- ---------------------
--- |
--- Switch to previous workspace
-prevWorkspace :: X()
-prevWorkspace = switchWorkspace (-1)
-
--- |
--- Move focused window to next workspace
-shiftToNext :: X()
-shiftToNext = shiftBy (1)
-
--- |
--- Move focused window to previous workspace
-shiftToPrev :: X ()
-shiftToPrev = shiftBy (-1)
-
-switchWorkspace :: Int -> X ()
-switchWorkspace d = wsBy d >>= windows . greedyView
-
-shiftBy :: Int -> X ()
-shiftBy d = wsBy d >>= windows . shift
-
-wsBy :: Int -> X (WorkspaceId)
-wsBy d = do
- ws <- gets windowset
- let orderedWs = sortBy (comparing wsIndex) (workspaces ws)
- let now = fromMaybe 0 $ findWsIndex (workspace (current ws)) orderedWs
- let next = orderedWs !! ((now + d) `mod` length orderedWs)
- return $ tag next
-
-
-wsIndex :: WindowSpace -> Maybe Int
-wsIndex ws = findIndex (==(tag ws)) Config.workspaces
-
-findWsIndex :: WindowSpace -> [WindowSpace] -> Maybe Int
-findWsIndex ws wss = findIndex ((== tag ws) . tag) wss