[XMonad] Don't show visible windows in window bringer menu

This commit is contained in:
Ivan Malison 2017-02-01 16:34:43 -08:00
parent 29546a87e9
commit e41497c463
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -77,7 +77,6 @@ main =
} }
where where
x +++ y = mappend y x x +++ y = mappend y x
-- Utility functions -- Utility functions
@ -122,9 +121,15 @@ withFocusedR f = withWindowSet (f . W.peek)
withFocusedD d f = maybe (return d) f <$> withWindowSet (return . W.peek) withFocusedD d f = maybe (return d) f <$> withWindowSet (return . W.peek)
withWorkspaceR f = withWindowSet $ f . W.workspace . W.current
mapP = mapP' id mapP = mapP' id
mapP' f f' = map (f A.&&& f') mapP' f f' = map (f A.&&& f')
minimizedWindows = withMinimized return
visibleWindows = (\\) <$> (withWorkspaceR $ return . W.integrate' . W.stack) <*> minimizedWindows
-- Selectors -- Selectors
@ -288,10 +293,10 @@ myLayoutHook =
-- WindowBringer -- WindowBringer
myWindowBringerConfig = myWindowBringerConfig =
WindowBringerConfig { menuCommand = "rofi" def { menuCommand = "rofi"
, menuArgs = ["-dmenu", "-i"] , menuArgs = ["-dmenu", "-i"]
, windowTitler = myDecorateName , windowTitler = myDecorateName
} }
classIfMatches window entry = classIfMatches window entry =
if' <$> runQuery (fst entry) window <*> if' <$> runQuery (fst entry) window <*>
@ -313,17 +318,19 @@ myDecorateName ws w = do
-- This needs access to X in order to unminimize, which means that I can't be -- This needs access to X in order to unminimize, which means that I can't be
-- done with the existing window bringer interface -- done with the existing window bringer interface
myBringWindow WindowBringerConfig { menuCommand = cmd myWindowAct c@WindowBringerConfig { menuCommand = cmd
, menuArgs = args , menuArgs = args
, windowTitler = titler } action =
} = do
windowMap' titler >>= DM.menuMapArgs cmd args >>= flip whenJust action visible <- visibleWindows
where windowMap' c { windowFilter = not . flip elem visible } >>=
action window = DM.menuMapArgs cmd args >>= flip whenJust action
sequence_
[ maximizeWindow window
, windows $ W.focusWindow window . bringWindow window myBringWindow window =
] sequence_ [ maximizeWindow window
, windows $ W.focusWindow window . bringWindow window
]
-- Dynamic Workspace Renaming -- Dynamic Workspace Renaming
@ -413,8 +420,6 @@ currentWS = withWindowSet $ return . getCurrentWS
workspaceWindows = maybe [] W.integrate <$> currentWS workspaceWindows = maybe [] W.integrate <$> currentWS
minimizedWindows = withMinimized return
getMinMaxWindows = getMinMaxWindows =
partition <$> (flip elem <$> minimizedWindows) <*> workspaceWindows partition <$> (flip elem <$> minimizedWindows) <*> workspaceWindows
@ -653,12 +658,12 @@ addKeys conf@XConfig {modMask = modm} =
-- Window manipulation -- Window manipulation
, ((modm, xK_g), andDeactivateFull . maybeUnminimizeAfter $ , ((modm, xK_g), andDeactivateFull . maybeUnminimizeAfter $
actionMenu myWindowBringerConfig greedyFocusWindow) myWindowAct myWindowBringerConfig $ windows . greedyFocusWindow)
, ((modm .|. shiftMask, xK_g), andDeactivateFull . sameClassOnly $ , ((modm .|. shiftMask, xK_g), andDeactivateFull . sameClassOnly $
actionMenu myWindowBringerConfig greedyFocusWindow) actionMenu myWindowBringerConfig greedyFocusWindow)
, ((modm, xK_b), andDeactivateFull $ myBringWindow myWindowBringerConfig) , ((modm, xK_b), andDeactivateFull $ myWindowAct myWindowBringerConfig myBringWindow)
, ((modm .|. shiftMask, xK_b), , ((modm .|. shiftMask, xK_b),
swapMinimizeStateAfter $ actionMenu myWindowBringerConfig swapFocusedWith) swapMinimizeStateAfter $ myWindowAct myWindowBringerConfig $ windows . swapFocusedWith)
, ((modm .|. controlMask, xK_space), goFullscreen) , ((modm .|. controlMask, xK_space), goFullscreen)
, ((modm, xK_m), withFocused minimizeWindow) , ((modm, xK_m), withFocused minimizeWindow)
, ((modm .|. shiftMask, xK_m), , ((modm .|. shiftMask, xK_m),