From 929a6a3f6ff177d9ecc6d948dd771b67eea0d257 Mon Sep 17 00:00:00 2001 From: slotThe Date: Wed, 13 Oct 2021 11:48:15 +0200 Subject: [PATCH 1/2] X.A.DynamicWorkspaces: Remove duplicates when melding When removing a workspace and distributing its windows, it's important to remove any duplicates that may be there due to, for example, usage of X.A.CopyWindow. X will only draw one of these window, leading to some artifacts. Related: https://github.com/xmonad/xmonad-contrib/issues/565 Co-authored-by: Tomas Janousek --- XMonad/Actions/DynamicWorkspaces.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/XMonad/Actions/DynamicWorkspaces.hs b/XMonad/Actions/DynamicWorkspaces.hs index 8b0c1e7a..ef507b34 100644 --- a/XMonad/Actions/DynamicWorkspaces.hs +++ b/XMonad/Actions/DynamicWorkspaces.hs @@ -34,7 +34,7 @@ module XMonad.Actions.DynamicWorkspaces ( WorkspaceIndex ) where -import XMonad.Prelude (find, isNothing, when) +import XMonad.Prelude (find, isNothing, nub, when) import XMonad hiding (workspaces) import XMonad.StackSet hiding (filter, modify, delete) 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 -- it exists. All the windows in that workspace are moved to the current -- 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 } , hidden = 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 meld x Nothing = 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) } } , hidden = xs ++ ys } removeWorkspace'' _ _ = s From bb5b64a198d1206fedbe25fd2381979692302671 Mon Sep 17 00:00:00 2001 From: slotThe Date: Wed, 13 Oct 2021 14:29:56 +0200 Subject: [PATCH 2/2] Update CHANGES.md: Fix X.A.DynamicWorkspaces freeze --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a90368c3..3579d151 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -737,6 +737,11 @@ - Removed deprecations for `spacing`, `spacingWithEdge`, `smartSpacing`, and `smartSpacingWithEdge`. + * `XMonad.Actions.DynamicWorkspaces` + + - Fixed a system freeze when using `X.A.CopyWindow.copy` in + combination with `removeWorkspace`. + ## 0.16 ### Breaking Changes