From cce7f503725e371488bd0e419718f4da1d105690 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Wed, 27 Feb 2019 22:58:37 -0500 Subject: [PATCH 1/6] Actions.GroupNavigation: hlint fixes --- XMonad/Actions/GroupNavigation.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XMonad/Actions/GroupNavigation.hs b/XMonad/Actions/GroupNavigation.hs index 408a5cd7..37eba27f 100644 --- a/XMonad/Actions/GroupNavigation.hs +++ b/XMonad/Actions/GroupNavigation.hs @@ -142,7 +142,7 @@ orderedWorkspaceList ss wsids = rotateTo isCurWS wspcs' where wspcs = SS.workspaces ss wspcsMap = Fold.foldl' (\m ws -> Map.insert (SS.tag ws) ws m) Map.empty wspcs - wspcs' = fmap (\wsid -> wspcsMap ! wsid) wsids + wspcs' = fmap (wspcsMap !) wsids isCurWS ws = SS.tag ws == SS.tag (SS.workspace $ SS.current ss) --- History navigation, requires a layout modifier ------------------- @@ -167,7 +167,7 @@ updateHistory :: HistoryDB -> X HistoryDB updateHistory (HistoryDB oldcur oldhist) = withWindowSet $ \ss -> do let newcur = SS.peek ss wins = Set.fromList $ SS.allWindows ss - newhist = flt (flip Set.member wins) (ins oldcur oldhist) + newhist = flt (`Set.member` wins) (ins oldcur oldhist) return $ HistoryDB newcur (del newcur newhist) where ins x xs = maybe xs (<| xs) x From 51bc32ea7575ecdcb2f05ebbc330f97b10564a8f Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Wed, 27 Feb 2019 22:59:07 -0500 Subject: [PATCH 2/6] Actions.GroupNavigation: add isOnAnyVisibleWS --- XMonad/Actions/GroupNavigation.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/XMonad/Actions/GroupNavigation.hs b/XMonad/Actions/GroupNavigation.hs index 37eba27f..f75f5026 100644 --- a/XMonad/Actions/GroupNavigation.hs +++ b/XMonad/Actions/GroupNavigation.hs @@ -27,6 +27,7 @@ module XMonad.Actions.GroupNavigation ( -- * Usage , nextMatchOrDo , nextMatchWithThis , historyHook + , isOnAnyVisibleWS ) where import Control.Monad.Reader @@ -216,3 +217,14 @@ findM cond xs = findM' cond (viewl xs) if isMatch then return (Just x') else findM qry xs' + + +isOnAnyVisibleWS :: Query Bool +isOnAnyVisibleWS = do + w <- ask + ws <- liftX $ gets windowset + let allVisible = concat $ maybe [] W.integrate . W.stack . W.workspace <$> W.current ws:W.visible ws + visibleWs = w `elem` allVisible + unfocused = maybe True (w /=) $ W.peek ws + return $ visibleWs && unfocused + From 52890f600721890372f19799f603f2bc05a646e7 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Wed, 27 Feb 2019 22:59:48 -0500 Subject: [PATCH 3/6] Actions.GroupNavigation: document isOnAnyVisibleWS --- XMonad/Actions/GroupNavigation.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/XMonad/Actions/GroupNavigation.hs b/XMonad/Actions/GroupNavigation.hs index f75f5026..e07c2688 100644 --- a/XMonad/Actions/GroupNavigation.hs +++ b/XMonad/Actions/GroupNavigation.hs @@ -16,12 +16,15 @@ -- query. -- -- Also provides a method for jumping back to the most recently used --- window in any given group. +-- window in any given group, and predefined groups. -- ---------------------------------------------------------------------- module XMonad.Actions.GroupNavigation ( -- * Usage -- $usage + + -- * Utilities + -- $utilities Direction (..) , nextMatch , nextMatchOrDo @@ -219,6 +222,14 @@ findM cond xs = findM' cond (viewl xs) else findM qry xs' +-- $utilities +-- #utilities# +-- Below are handy queries for use with 'nextMatch', 'nextMatchOrDo', +-- and 'nextMatchWithThis'. + +-- | A query that matches all windows on visible workspaces. This is +-- useful for configurations with multiple screens, and matches even +-- invisible windows. isOnAnyVisibleWS :: Query Bool isOnAnyVisibleWS = do w <- ask From e12511c658b1f95d3de720f182cc7bdbacf850c6 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Sat, 2 Mar 2019 09:32:16 -0500 Subject: [PATCH 4/6] Actions.GroupNavigation: move "Utilities" header for documentation --- XMonad/Actions/GroupNavigation.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/XMonad/Actions/GroupNavigation.hs b/XMonad/Actions/GroupNavigation.hs index e07c2688..eb465da9 100644 --- a/XMonad/Actions/GroupNavigation.hs +++ b/XMonad/Actions/GroupNavigation.hs @@ -22,14 +22,14 @@ module XMonad.Actions.GroupNavigation ( -- * Usage -- $usage - - -- * Utilities - -- $utilities Direction (..) , nextMatch , nextMatchOrDo , nextMatchWithThis , historyHook + + -- * Utilities + -- $utilities , isOnAnyVisibleWS ) where From 84c63abda6e5d71dd0ae48818d836d887ac689e1 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Sat, 2 Mar 2019 09:36:36 -0500 Subject: [PATCH 5/6] Add changelog entry for isOnAnyVisibleWS --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 083d8d2d..54adb20b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -58,6 +58,12 @@ [WorkspaceId]` transformation to apply over the list of workspace tags resulting from the dynamic order. + * `XMonad.Actions.GroupNavigation` + + Add a utility function `isOnAnyVisibleWS :: Query Bool` to allow easy + cycling between all windows on all visible workspaces. + + ## 0.15 ### Breaking Changes From 0cfe3a288e7cd0489e8df1fbd12b8d0343a40f87 Mon Sep 17 00:00:00 2001 From: Alex Hirzel Date: Sat, 2 Mar 2019 09:36:47 -0500 Subject: [PATCH 6/6] whitespace reformat in changelog --- CHANGES.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 54adb20b..5d4534e0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -54,9 +54,10 @@ into `foo/bar`, instead of `~/bar` as expected. * `XMonad.Actions.DynamicWorkspaceOrder` + Add a version of `withNthWorkspace` that takes a `[WorkspaceId] -> - [WorkspaceId]` transformation to apply over the list of workspace tags - resulting from the dynamic order. + [WorkspaceId]` transformation to apply over the list of workspace tags + resulting from the dynamic order. * `XMonad.Actions.GroupNavigation`