Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differentiate between floating and tiled in rects and only apply tileWindow to tiled windows #207

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## unknown (unknown)

* Only apply `tileWindow` to tiled windows, so that floating windows are not
accidentally resized.

## 0.15 (September 30, 2018)

* Reimplement `sendMessage` to deal properly with windowset changes made
Expand Down
19 changes: 14 additions & 5 deletions src/XMonad/Operations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import XMonad.Layout (Full(..))
import qualified XMonad.StackSet as W

import Data.Maybe
import Data.Monoid (Endo(..),Any(..))
import Data.Monoid (Endo(..), Any(..), mconcat)
import Data.List (nub, (\\), find)
import Data.Bits ((.|.), (.&.), complement, testBit)
import Data.Ratio
Expand Down Expand Up @@ -128,7 +128,7 @@ windows f = do
-- for each workspace, layout the currently visible workspaces
let allscreens = W.screens ws
summed_visible = scanl (++) [] $ map (W.integrate' . W.stack . W.workspace) allscreens
rects <- fmap concat $ forM (zip allscreens summed_visible) $ \ (w, vis) -> do
rects <- fmap mconcat $ forM (zip allscreens summed_visible) $ \ (w, vis) -> do
let wsp = W.workspace w
this = W.view n ws
n = W.tag wsp
Expand All @@ -151,11 +151,12 @@ windows f = do

io $ restackWindows d (map fst vs)
-- return the visible windows for this workspace:
return vs
return (flt, rs)

let visible = map fst rects
let visible = let (floating, tiled) = rects in map fst floating ++ map fst tiled

mapM_ (uncurry tileWindow) rects
mapM_ (uncurry tileWindowFloating) (fst rects)
mapM_ (uncurry tileWindow) (snd rects)

whenJust (W.peek ws) $ \w -> do
fbs <- asks (focusedBorderColor . config)
Expand Down Expand Up @@ -270,6 +271,14 @@ clearEvents mask = withDisplay $ \d -> io $ do
more <- checkMaskEvent d mask p
when more again -- beautiful

-- | tileWindowFloating. Moves and resizes w so that its client area fits inside
-- the given rectangle. Since this window is floating, we allow the border to
-- expand outwards, which is the default behavior of X.
tileWindowFloating :: Window -> Rectangle -> X ()
tileWindowFloating w r = withDisplay $ \d ->
io $ moveResizeWindow d w (rect_x r) (rect_y r)
(rect_width r) (rect_height r)

-- | tileWindow. Moves and resizes w such that it fits inside the given
-- rectangle, including its border.
tileWindow :: Window -> Rectangle -> X ()
Expand Down