aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-12-05 18:06:33 -0700
committerJosh Rahm <rahm@google.com>2023-12-05 18:06:33 -0700
commit8d67f1ea8c614f12ddfc77d5727fb7fd8472484b (patch)
treed048a9d74954c616340162198d51dea36d5b942c /src/Rahm
parent122b51770305f3f22050ba7000d168e298eb1661 (diff)
downloadrde-8d67f1ea8c614f12ddfc77d5727fb7fd8472484b.tar.gz
rde-8d67f1ea8c614f12ddfc77d5727fb7fd8472484b.tar.bz2
rde-8d67f1ea8c614f12ddfc77d5727fb7fd8472484b.zip
Fixed problem with the hole layout where it was not passing on the focused window correctly
Diffstat (limited to 'src/Rahm')
-rw-r--r--src/Rahm/Desktop/Layout.hs4
-rw-r--r--src/Rahm/Desktop/Layout/Hole.hs25
-rw-r--r--src/Rahm/Desktop/StackSet.hs8
3 files changed, 23 insertions, 14 deletions
diff --git a/src/Rahm/Desktop/Layout.hs b/src/Rahm/Desktop/Layout.hs
index f4c9d8d..d71989f 100644
--- a/src/Rahm/Desktop/Layout.hs
+++ b/src/Rahm/Desktop/Layout.hs
@@ -40,8 +40,8 @@ import XMonad.Layout.Spacing (Border (..), spacingRaw)
import XMonad.Layout.Spiral (spiral)
myLayout =
- hole $
- fullscreenFull $
+ fullscreenFull $
+ hole $
avoidStruts myLayoutList
mySpacing = spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True
diff --git a/src/Rahm/Desktop/Layout/Hole.hs b/src/Rahm/Desktop/Layout/Hole.hs
index d00cc29..8bebb36 100644
--- a/src/Rahm/Desktop/Layout/Hole.hs
+++ b/src/Rahm/Desktop/Layout/Hole.hs
@@ -89,18 +89,19 @@ instance (LayoutClass l a, a ~ Window) => LayoutClass (Hole l) a where
| Just positions <- sortIt <$> Map.lookup t mp =
let integrated = W.integrate s
in W.Workspace t l $
- W.differentiate $
- addr integrated $
- foldl
- ( \((idx, pos, fakeid), ret) w ->
- case pos of
- ((TilePosition _ n, win) : tpos)
- | n == idx && win `notElem` integrated ->
- ((idx + 1, tpos, fakeid - 1), w : fakeid : ret)
- _ -> ((idx + 1, pos, fakeid), w : ret)
- )
- ((0, positions, -1), [])
- integrated
+ W.differentiateWithFocus (W.focus s) $
+ reverse $
+ addr integrated $
+ foldl
+ ( \((idx, pos, fakeid), ret) w ->
+ case pos of
+ ((TilePosition _ n, win) : tpos)
+ | n == idx && win `notElem` integrated ->
+ ((idx + 1, tpos, fakeid - 1), w : fakeid : ret)
+ _ -> ((idx + 1, pos, fakeid), w : ret)
+ )
+ ((0, positions, -1), [])
+ integrated
app _ w = w
sortIt = sortOn (\(TilePosition _ p, _) -> p)
diff --git a/src/Rahm/Desktop/StackSet.hs b/src/Rahm/Desktop/StackSet.hs
index 7793ec5..2dc8787 100644
--- a/src/Rahm/Desktop/StackSet.hs
+++ b/src/Rahm/Desktop/StackSet.hs
@@ -1,6 +1,7 @@
module Rahm.Desktop.StackSet
( masterWindow,
allVisibleWindows,
+ differentiateWithFocus,
concatMapTiledWindows,
windowsOnWorkspace,
findWorkspace,
@@ -262,6 +263,13 @@ modifyWorkspace tag fn =
else ws
)
+differentiateWithFocus :: (Eq a) => a -> [a] -> Maybe (Stack a)
+differentiateWithFocus _ [] = Nothing
+differentiateWithFocus thing lst =
+ case break (==thing) lst of
+ (up, foc:down) -> Just $ Stack foc (reverse up) down
+ _ -> differentiate lst
+
getFocusedWindow :: StackSet i l a s sd -> Maybe a
getFocusedWindow (StackSet cur _ _ _) = W.focus <$> (W.stack . W.workspace) cur