From 40b3897f959ae292c60a52d563e62fd21a40022a Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Wed, 30 Dec 2009 20:19:53 +0100 Subject: 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 --- XMonad/Actions/CycleWS.hs | 10 ++++++++-- 1 file 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 -- cgit v1.2.3