diff options
author | Brent Yorgey <byorgey@cis.upenn.edu> | 2009-12-30 20:19:53 +0100 |
---|---|---|
committer | Brent Yorgey <byorgey@cis.upenn.edu> | 2009-12-30 20:19:53 +0100 |
commit | 40b3897f959ae292c60a52d563e62fd21a40022a (patch) | |
tree | c08d3e3c7b307dc2007d3659ba21d1a0013abf55 /XMonad/Actions | |
parent | 2fbf37261b018916f79bfc9f5e1ccbbdf69498c0 (diff) | |
download | XMonadContrib-40b3897f959ae292c60a52d563e62fd21a40022a.tar.gz XMonadContrib-40b3897f959ae292c60a52d563e62fd21a40022a.tar.xz XMonadContrib-40b3897f959ae292c60a52d563e62fd21a40022a.zip |
X.A.CycleWS: export generalized 'doTo' function for performing an action on a workspace relative to the current one
Ignore-this: 7cf8efe7c45b501cbcea0943f667b77e
darcs-hash:20091230191953-1e371-32fbdd9891ca3a8e55d6cc6427e7fed2c330f57b.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r-- | XMonad/Actions/CycleWS.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/XMonad/Actions/CycleWS.hs b/XMonad/Actions/CycleWS.hs index ee462d9..ded028e 100644 --- a/XMonad/Actions/CycleWS.hs +++ b/XMonad/Actions/CycleWS.hs @@ -65,6 +65,7 @@ module XMonad.Actions.CycleWS ( , shiftTo , moveTo + , doTo -- * The mother-combinator @@ -244,12 +245,17 @@ wsTypeToPred (WSIs p) = p -- | View the next workspace in the given direction that satisfies -- the given condition. moveTo :: Direction1D -> WSType -> X () -moveTo dir t = findWorkspace getSortByIndex dir t 1 >>= windows . greedyView +moveTo dir t = doTo dir t getSortByIndex (windows . greedyView) -- | Move the currently focused window to the next workspace in the -- given direction that satisfies the given condition. shiftTo :: Direction1D -> WSType -> X () -shiftTo dir t = findWorkspace getSortByIndex dir t 1 >>= windows . shift +shiftTo dir t = doTo dir t getSortByIndex (windows . shift) + +-- | Using the given sort, find the next workspace in the given +-- direction of the given type, and perform the given action on it. +doTo :: Direction1D -> WSType -> X WorkspaceSort -> (WorkspaceId -> X ()) -> X () +doTo dir t srt act = findWorkspace srt dir t 1 >>= act -- | Given a function @s@ to sort workspaces, a direction @dir@, a -- predicate @p@ on workspaces, and an integer @n@, find the tag of |