mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Make Actions.WindowGo.raiseNextMaybe span over all workspaces. Fixes #120
This commit is contained in:
parent
0a1d8505a0
commit
9f9b5d3748
@ -38,13 +38,14 @@ module XMonad.Actions.WindowGo (
|
|||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Char (toLower)
|
import Data.Char (toLower)
|
||||||
|
import qualified Data.List as L (nub,sortBy)
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import XMonad (Query(), X(), ManageHook, WindowSet, withWindowSet, runQuery, liftIO, ask)
|
import XMonad (Query(), X(), ManageHook, WindowSet, withWindowSet, runQuery, liftIO, ask)
|
||||||
import Graphics.X11 (Window)
|
import Graphics.X11 (Window)
|
||||||
import XMonad.ManageHook
|
import XMonad.ManageHook
|
||||||
import XMonad.Operations (windows)
|
import XMonad.Operations (windows)
|
||||||
import XMonad.Prompt.Shell (getBrowser, getEditor)
|
import XMonad.Prompt.Shell (getBrowser, getEditor)
|
||||||
import qualified XMonad.StackSet as W (allWindows, peek, swapMaster, focusWindow)
|
import qualified XMonad.StackSet as W (peek, swapMaster, focusWindow, workspaces, StackSet, Workspace, integrate', tag, stack)
|
||||||
import XMonad.Util.Run (safeSpawnProg)
|
import XMonad.Util.Run (safeSpawnProg)
|
||||||
{- $usage
|
{- $usage
|
||||||
|
|
||||||
@ -66,12 +67,20 @@ appropriate one, or cover your bases by using instead something like:
|
|||||||
For detailed instructions on editing your key bindings, see
|
For detailed instructions on editing your key bindings, see
|
||||||
"XMonad.Doc.Extending#Editing_key_bindings". -}
|
"XMonad.Doc.Extending#Editing_key_bindings". -}
|
||||||
|
|
||||||
|
workspacesSorted :: Ord i => W.StackSet i l a s sd -> [W.Workspace i l a]
|
||||||
|
workspacesSorted s = L.sortBy (\u t -> W.tag u `compare` W.tag t) $
|
||||||
|
W.workspaces s
|
||||||
|
|
||||||
|
-- | Get a list of all windows in the 'StackSet' with an absolute ordering of workspaces
|
||||||
|
allWindowsSorted :: Ord i => Eq a => W.StackSet i l a s sd -> [a]
|
||||||
|
allWindowsSorted = L.nub . concatMap (W.integrate' . W.stack) . workspacesSorted
|
||||||
|
|
||||||
-- | If windows that satisfy the query exist, apply the supplied
|
-- | If windows that satisfy the query exist, apply the supplied
|
||||||
-- function to them, otherwise run the action given as
|
-- function to them, otherwise run the action given as
|
||||||
-- second parameter.
|
-- second parameter.
|
||||||
ifWindows :: Query Bool -> ([Window] -> X ()) -> X () -> X ()
|
ifWindows :: Query Bool -> ([Window] -> X ()) -> X () -> X ()
|
||||||
ifWindows qry f el = withWindowSet $ \wins -> do
|
ifWindows qry f el = withWindowSet $ \wins -> do
|
||||||
matches <- filterM (runQuery qry) $ W.allWindows wins
|
matches <- filterM (runQuery qry) $ allWindowsSorted wins
|
||||||
case matches of
|
case matches of
|
||||||
[] -> el
|
[] -> el
|
||||||
ws -> f ws
|
ws -> f ws
|
||||||
|
Loading…
x
Reference in New Issue
Block a user