module XMonad.Actions.DwmPromote (
dwmpromote
) where
import XMonad
import XMonad.StackSet
import XMonad.Prelude
import qualified Data.List.NonEmpty as NE
dwmpromote :: X ()
dwmpromote :: X ()
dwmpromote = (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (WindowSet -> WindowSet) -> X ()
forall a b. (a -> b) -> a -> b
$ (Stack Window -> Stack Window) -> WindowSet -> WindowSet
forall a i l s sd.
(Stack a -> Stack a) -> StackSet i l a s sd -> StackSet i l a s sd
modify' ((Stack Window -> Stack Window) -> WindowSet -> WindowSet)
-> (Stack Window -> Stack Window) -> WindowSet -> WindowSet
forall a b. (a -> b) -> a -> b
$
\Stack Window
c -> case Stack Window
c of
Stack Window
_ [] [] -> Stack Window
c
Stack Window
t [] (Window
r:[Window]
rs) -> Window -> [Window] -> [Window] -> Stack Window
forall a. a -> [a] -> [a] -> Stack a
Stack Window
r [] (Window
tWindow -> [Window] -> [Window]
forall a. a -> [a] -> [a]
:[Window]
rs)
Stack Window
t (Window
l:[Window]
ls) [Window]
rs -> Window -> [Window] -> [Window] -> Stack Window
forall a. a -> [a] -> [a] -> Stack a
Stack Window
t [] ([Window]
ys [Window] -> [Window] -> [Window]
forall a. [a] -> [a] -> [a]
++ Window
y Window -> [Window] -> [Window]
forall a. a -> [a] -> [a]
: [Window]
rs) where (Window
y :| [Window]
ys) = NonEmpty Window -> NonEmpty Window
forall a. NonEmpty a -> NonEmpty a
NE.reverse (Window
l Window -> [Window] -> NonEmpty Window
forall a. a -> [a] -> NonEmpty a
:| [Window]
ls)