mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.U.NamedScratchpads: Check for "new" workspace in nsHideOnFocusLoss
When XMonad was recently restarted, it can happen that the workspace history is empty, hence the last focused window could actually be the currently focused one. In that case, we don't want to go through the machinery of looking to hide any NSPs, as there is only one window in the current workspace (the focused one). This may or may not be a scratchpad, we don't care. Fixes: https://github.com/xmonad/xmonad-contrib/issues/779
This commit is contained in:
parent
58e7f6d3c3
commit
10c1a93963
@ -286,8 +286,15 @@ allNamedScratchpadAction = someNamedScratchpadAction mapM_ runApplication
|
||||
nsHideOnFocusLoss :: NamedScratchpads -> X ()
|
||||
nsHideOnFocusLoss scratches = withWindowSet $ \winSet -> do
|
||||
let cur = W.currentTag winSet
|
||||
withRecentsIn cur () $ \lastFocus _ ->
|
||||
when (lastFocus `elem` W.index winSet && cur /= scratchpadWorkspaceTag) $
|
||||
withRecentsIn cur () $ \lastFocus curFocus -> do
|
||||
let isWorthy =
|
||||
-- Check for the window being on the current workspace; if there
|
||||
-- is no history (i.e., curFocus ≡ lastFocus), don't do anything
|
||||
-- because the potential scratchpad is definitely focused.
|
||||
lastFocus `elem` W.index winSet && lastFocus /= curFocus
|
||||
-- Don't do anything on the NSP workspace, lest the world explodes.
|
||||
&& cur /= scratchpadWorkspaceTag
|
||||
when isWorthy $
|
||||
whenX (isNSP lastFocus scratches) $
|
||||
shiftToNSP (W.workspaces winSet) ($ lastFocus)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user