mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Expanded on X.L.Maximize functionality
1. Move maximized window into the background when it's not focused. 2. Changed semantics so that maximizing a different window will automatically restore the currently maximized window and maximize the new one (previously this had to be done in two seperate steps).
This commit is contained in:
parent
5aa7d3635e
commit
b5b9a3dc67
@ -23,6 +23,7 @@ module XMonad.Layout.Maximize (
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
|
import qualified XMonad.StackSet as S
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
import Data.List ( partition )
|
import Data.List ( partition )
|
||||||
|
|
||||||
@ -60,19 +61,23 @@ maximizeRestore = MaximizeRestore
|
|||||||
|
|
||||||
instance LayoutModifier Maximize Window where
|
instance LayoutModifier Maximize Window where
|
||||||
modifierDescription (Maximize _) = "Maximize"
|
modifierDescription (Maximize _) = "Maximize"
|
||||||
redoLayout (Maximize mw) rect _ wrs = case mw of
|
pureModifier (Maximize (Just target)) rect (Just (S.Stack focused _ _)) wrs =
|
||||||
Just win ->
|
if focused == target
|
||||||
return (maxed ++ rest, Nothing)
|
then (maxed ++ rest, Nothing)
|
||||||
where
|
else (rest ++ maxed, Nothing)
|
||||||
maxed = map (\(w, _) -> (w, maxRect)) toMax
|
where
|
||||||
(toMax, rest) = partition (\(w, _) -> w == win) wrs
|
(toMax, rest) = partition (\(w, _) -> w == target) wrs
|
||||||
maxRect = Rectangle (rect_x rect + 50) (rect_y rect + 50)
|
maxed = map (\(w, _) -> (w, maxRect)) toMax
|
||||||
(rect_width rect - 100) (rect_height rect - 100)
|
maxRect = Rectangle (rect_x rect + 25) (rect_y rect + 25)
|
||||||
Nothing -> return (wrs, Nothing)
|
(rect_width rect - 50) (rect_height rect - 50)
|
||||||
|
pureModifier _ _ _ wrs = (wrs, Nothing)
|
||||||
|
|
||||||
handleMess (Maximize mw) m = case fromMessage m of
|
handleMess (Maximize mw) m = case fromMessage m of
|
||||||
Just (MaximizeRestore w) -> case mw of
|
Just (MaximizeRestore w) -> case mw of
|
||||||
Just _ -> return $ Just $ Maximize Nothing
|
Just w' -> if (w == w')
|
||||||
Nothing -> return $ Just $ Maximize $ Just w
|
then return $ Just $ Maximize Nothing -- restore window
|
||||||
|
else return $ Just $ Maximize $ Just w -- maximize different window
|
||||||
|
Nothing -> return $ Just $ Maximize $ Just w -- maximize window
|
||||||
_ -> return Nothing
|
_ -> return Nothing
|
||||||
|
|
||||||
-- vim: sw=4:et
|
-- vim: sw=4:et
|
||||||
|
Loading…
x
Reference in New Issue
Block a user