Skip to content

Commit 0dc8796

Browse files
authoredNov 24, 2024··
Merge pull request xmonad#914 from liskin/noborders-resetborder
X.L.NoBorders: Listen to DestroyWindowEvents and garbage collect
2 parents d19ea05 + fe826ca commit 0dc8796

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
 

‎CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
used to avoid flicker and unnecessary workspace reshuffling if multiple
2525
`xrandr` commands are used to reconfigure the display layout.
2626

27+
* `XMonad.Layout.NoBorders`
28+
29+
- It's no longer necessary to use `borderEventHook` to garbage collect
30+
`alwaysHidden`/`neverHidden` lists. The layout listens to
31+
`DestroyWindowEvent` messages instead, which are broadcast to layouts
32+
since xmonad v0.17.0.
33+
2734
## 0.18.1 (August 20, 2024)
2835

2936
### Breaking Changes

‎XMonad/Layout/NoBorders.hs

+6-5
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ data ConfigurableBorder p w = ConfigurableBorder
143143

144144
-- | Only necessary with 'BorderMessage' - remove non-existent windows from the
145145
-- 'alwaysHidden' or 'neverHidden' lists.
146+
{-# DEPRECATED borderEventHook "No longer needed." #-}
146147
borderEventHook :: Event -> X All
147-
borderEventHook DestroyWindowEvent{ ev_window = w } = do
148-
broadcastMessage $ ResetBorder w
149-
return $ All True
150148
borderEventHook _ = return $ All True
151149

152150
instance (Read p, Show p, SetsAmbiguous p) => LayoutModifier (ConfigurableBorder p) Window where
@@ -167,14 +165,17 @@ instance (Read p, Show p, SetsAmbiguous p) => LayoutModifier (ConfigurableBorder
167165
in ConfigurableBorder gh <$> consNewIf ah (not b)
168166
<*> consNewIf nh b
169167
<*> pure ch
170-
| Just (ResetBorder w) <- fromMessage m =
168+
| Just (ResetBorder w) <- fromMessage m = resetBorder w
169+
| Just DestroyWindowEvent { ev_window = w } <- fromMessage m = resetBorder w
170+
| otherwise = Nothing
171+
where
172+
resetBorder w =
171173
let delete' e l = if e `elem` l then (True,delete e l) else (False,l)
172174
(da,ah') = delete' w ah
173175
(dn,nh') = delete' w nh
174176
in if da || dn
175177
then Just cb { alwaysHidden = ah', neverHidden = nh' }
176178
else Nothing
177-
| otherwise = Nothing
178179

179180
-- | SetsAmbiguous allows custom actions to generate lists of windows that
180181
-- should not have borders drawn through 'ConfigurableBorder'

0 commit comments

Comments
 (0)
Please sign in to comment.