Merge pull request #621 from slotThe/dynamic-workspaces-nub

X.A.DynamicWorkspaces: Remove duplicates when melding
This commit is contained in:
Tomáš Janoušek
2021-10-13 16:51:05 +02:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -737,6 +737,11 @@
- Removed deprecations for `spacing`, `spacingWithEdge`, - Removed deprecations for `spacing`, `spacingWithEdge`,
`smartSpacing`, and `smartSpacingWithEdge`. `smartSpacing`, and `smartSpacingWithEdge`.
* `XMonad.Actions.DynamicWorkspaces`
- Fixed a system freeze when using `X.A.CopyWindow.copy` in
combination with `removeWorkspace`.
## 0.16 ## 0.16
### Breaking Changes ### Breaking Changes

View File

@@ -34,7 +34,7 @@ module XMonad.Actions.DynamicWorkspaces (
WorkspaceIndex WorkspaceIndex
) where ) where
import XMonad.Prelude (find, isNothing, when) import XMonad.Prelude (find, isNothing, nub, when)
import XMonad hiding (workspaces) import XMonad hiding (workspaces)
import XMonad.StackSet hiding (filter, modify, delete) import XMonad.StackSet hiding (filter, modify, delete)
import XMonad.Prompt.Workspace ( Wor(Wor), workspacePrompt ) import XMonad.Prompt.Workspace ( Wor(Wor), workspacePrompt )
@@ -243,7 +243,7 @@ addHiddenWorkspace' add newtag l s@StackSet{ hidden = ws } = s { hidden = add (W
-- | Remove the hidden workspace with the given tag from the StackSet, if -- | Remove the hidden workspace with the given tag from the StackSet, if
-- it exists. All the windows in that workspace are moved to the current -- it exists. All the windows in that workspace are moved to the current
-- workspace. -- workspace.
removeWorkspace' :: (Eq i) => i -> StackSet i l a sid sd -> StackSet i l a sid sd removeWorkspace' :: (Eq i, Eq a) => i -> StackSet i l a sid sd -> StackSet i l a sid sd
removeWorkspace' torem s@StackSet{ current = scr@Screen { workspace = wc } removeWorkspace' torem s@StackSet{ current = scr@Screen { workspace = wc }
, hidden = hs } , hidden = hs }
= let (xs, ys) = break ((== torem) . tag) hs = let (xs, ys) = break ((== torem) . tag) hs
@@ -251,7 +251,7 @@ removeWorkspace' torem s@StackSet{ current = scr@Screen { workspace = wc }
where meld Nothing Nothing = Nothing where meld Nothing Nothing = Nothing
meld x Nothing = x meld x Nothing = x
meld Nothing x = x meld Nothing x = x
meld (Just x) (Just y) = differentiate (integrate x ++ integrate y) meld (Just x) (Just y) = differentiate . nub $ integrate x ++ integrate y
removeWorkspace'' xs (y:ys) = s { current = scr { workspace = wc { stack = meld (stack y) (stack wc) } } removeWorkspace'' xs (y:ys) = s { current = scr { workspace = wc { stack = meld (stack y) (stack wc) } }
, hidden = xs ++ ys } , hidden = xs ++ ys }
removeWorkspace'' _ _ = s removeWorkspace'' _ _ = s