mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Added withFirstMinimized and withFirstMinimized'.
Also changed the order of the `L.intersect` line to prevent the map key ordering from changing the minimizedStack.
This commit is contained in:
parent
12227d37ca
commit
8266feba95
@ -124,6 +124,11 @@
|
||||
changed and you want to re-sort windows into the appropriate
|
||||
sub-layout.
|
||||
|
||||
* `XMonad.Actions.Minimize`
|
||||
|
||||
- Now has `withFirstMinimized` and `withFirstMinimized'` so you can perform
|
||||
actions with both the last and first minimized windows easily.
|
||||
|
||||
## 0.13 (February 10, 2017)
|
||||
|
||||
### Breaking Changes
|
||||
|
@ -29,6 +29,8 @@ module XMonad.Actions.Minimize
|
||||
, maximizeWindowAndFocus
|
||||
, withLastMinimized
|
||||
, withLastMinimized'
|
||||
, withFirstMinimized
|
||||
, withFirstMinimized'
|
||||
, withMinimized
|
||||
) where
|
||||
|
||||
@ -85,7 +87,7 @@ modified f = XS.modified $
|
||||
in Minimized { rectMap = newRectMap
|
||||
, minimizedStack = (newWindows L.\\ oldStack)
|
||||
++
|
||||
(newWindows `L.intersect` oldStack)
|
||||
(oldStack `L.intersect` newWindows)
|
||||
}
|
||||
|
||||
|
||||
@ -115,6 +117,16 @@ maximizeWindow = maximizeWindowAndChangeWSet $ const id
|
||||
maximizeWindowAndFocus :: Window -> X ()
|
||||
maximizeWindowAndFocus = maximizeWindowAndChangeWSet W.focusWindow
|
||||
|
||||
-- | Perform an action with first minimized window on current workspace
|
||||
-- or do nothing if there is no minimized windows on current workspace
|
||||
withFirstMinimized :: (Window -> X ()) -> X ()
|
||||
withFirstMinimized action = withFirstMinimized' (flip whenJust action)
|
||||
|
||||
-- | Like withFirstMinimized but the provided action is always invoked with a
|
||||
-- 'Maybe Window', that will be nothing if there is no first minimized window.
|
||||
withFirstMinimized' :: (Maybe Window -> X ()) -> X ()
|
||||
withFirstMinimized' action = withMinimized (action . listToMaybe . reverse)
|
||||
|
||||
-- | Perform an action with last minimized window on current workspace
|
||||
-- or do nothing if there is no minimized windows on current workspace
|
||||
withLastMinimized :: (Window -> X ()) -> X ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user