mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-03 05:31:53 -07:00
Xmonad.Layout.NoBorders: make smartBorders unborder fullscreen floating windows (bug 157)
This commit is contained in:
@@ -29,6 +29,7 @@ import XMonad
|
|||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import Data.List ((\\))
|
import Data.List ((\\))
|
||||||
|
import qualified Data.Map as M
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your ~\/.xmonad\/xmonad.hs file:
|
-- You can use this module with the following in your ~\/.xmonad\/xmonad.hs file:
|
||||||
@@ -72,18 +73,25 @@ instance LayoutModifier SmartBorder Window where
|
|||||||
unhook (SmartBorder s) = asks (borderWidth . config) >>= setBorders s
|
unhook (SmartBorder s) = asks (borderWidth . config) >>= setBorders s
|
||||||
|
|
||||||
redoLayout (SmartBorder s) _ _ wrs = do
|
redoLayout (SmartBorder s) _ _ wrs = do
|
||||||
ss <- gets (filter (nonzerorect . screenRect . W.screenDetail) . W.screens . windowset)
|
wset <- gets windowset
|
||||||
|
let
|
||||||
if singleton ws && singleton ss
|
screens = filter (nonzerorect . screenRect . W.screenDetail) . W.screens $ wset
|
||||||
then do
|
ws
|
||||||
|
| singleton screens = tiled ++ floating
|
||||||
|
| otherwise = []
|
||||||
|
tiled = case wrs of
|
||||||
|
[(w, _)] -> [w]
|
||||||
|
_ -> []
|
||||||
|
floating =
|
||||||
|
[ w |
|
||||||
|
(w, W.RationalRect px py wx wy) <- M.toList . W.floating $ wset,
|
||||||
|
px <= 0, py <= 0,
|
||||||
|
wx >= 1, wy >= 1
|
||||||
|
]
|
||||||
asks (borderWidth . config) >>= setBorders (s \\ ws)
|
asks (borderWidth . config) >>= setBorders (s \\ ws)
|
||||||
setBorders ws 0
|
setBorders ws 0
|
||||||
return (wrs, Just $ SmartBorder ws)
|
return (wrs, Just $ SmartBorder ws)
|
||||||
else do
|
|
||||||
asks (borderWidth . config) >>= setBorders s
|
|
||||||
return (wrs, Just $ SmartBorder [])
|
|
||||||
where
|
where
|
||||||
ws = map fst wrs
|
|
||||||
singleton = null . drop 1
|
singleton = null . drop 1
|
||||||
nonzerorect (Rectangle _ _ 0 0) = False
|
nonzerorect (Rectangle _ _ 0 0) = False
|
||||||
nonzerorect _ = True
|
nonzerorect _ = True
|
||||||
|
Reference in New Issue
Block a user