mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
vanadium/xmonad: refactor manage gook
This commit is contained in:
parent
bbf6651440
commit
5539bed063
1 changed files with 26 additions and 18 deletions
|
|
@ -24,6 +24,7 @@ import XMonad.Util.NamedScratchpad
|
||||||
import XMonad.Util.SpawnOnce
|
import XMonad.Util.SpawnOnce
|
||||||
|
|
||||||
import Data.Map.Strict qualified as M
|
import Data.Map.Strict qualified as M
|
||||||
|
import Data.Monoid (Endo(Endo))
|
||||||
import Graphics.X11.ExtraTypes.XF86
|
import Graphics.X11.ExtraTypes.XF86
|
||||||
import System.Posix
|
import System.Posix
|
||||||
|
|
||||||
|
|
@ -49,12 +50,6 @@ main =
|
||||||
|
|
||||||
, logHook =
|
, logHook =
|
||||||
let
|
let
|
||||||
isOneOf :: Eq a => Query a -> [a] -> Query Bool
|
|
||||||
isOneOf q = fmap or . traverse (q =?)
|
|
||||||
|
|
||||||
isFocused :: Query Bool
|
|
||||||
isFocused = fmap not isUnfocused
|
|
||||||
|
|
||||||
fadeHook =
|
fadeHook =
|
||||||
composeOne
|
composeOne
|
||||||
[ -- easier to paint over stuff
|
[ -- easier to paint over stuff
|
||||||
|
|
@ -107,9 +102,16 @@ main =
|
||||||
let
|
let
|
||||||
hasEvenWindows :: X Bool
|
hasEvenWindows :: X Bool
|
||||||
hasEvenWindows = g <$> get
|
hasEvenWindows = g <$> get
|
||||||
where g =
|
where g = even . length . W.integrate'
|
||||||
even . length . W.integrate'
|
. W.stack . W.workspace . W.current . windowset
|
||||||
. W.stack . W.workspace . W.current . windowset
|
|
||||||
|
-- When having a lot of windows this will converge into the middle of the stack
|
||||||
|
insertInMiddle :: Query (Endo WindowSet)
|
||||||
|
insertInMiddle =
|
||||||
|
ifM
|
||||||
|
(liftX hasEvenWindows)
|
||||||
|
(insertPosition Below Newer) -- New window is odd
|
||||||
|
(insertPosition Above Newer) -- New window is even
|
||||||
in
|
in
|
||||||
composeAll
|
composeAll
|
||||||
[ className ~? "NautilusPreviewer" --> customFloating centeredFloat
|
[ className ~? "NautilusPreviewer" --> customFloating centeredFloat
|
||||||
|
|
@ -121,15 +123,14 @@ main =
|
||||||
|
|
||||||
<>
|
<>
|
||||||
composeOne
|
composeOne
|
||||||
[ className =? "firefox" -?> insertPosition Above Newer
|
[ className =? "firefox" -?> insertPosition Master Newer
|
||||||
, className =? "sioyek" -?> insertPosition Below Older
|
, className =? "kitty" -?> insertPosition Below Newer
|
||||||
, className =? "kitty" -?> insertPosition Below Newer
|
, className `isOneOf`
|
||||||
, className ~? "Nautilus" -?> insertPosition Below Older -- For some reason Older doesn't work
|
[ "sioyek"
|
||||||
|
, "Nautilus"
|
||||||
, ifM
|
]
|
||||||
(liftX hasEvenWindows)
|
-?> insertPosition End Older
|
||||||
(Just <$> insertPosition Below Newer) -- New window is odd
|
, Just <$> insertInMiddle
|
||||||
(Just <$> insertPosition Above Newer) -- New window is even
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,6 +271,13 @@ xmobarConfig = statusBarProp "xmobar -x 0" (pure myPrettyPrinter)
|
||||||
, ppSep = " | "
|
, ppSep = " | "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
isOneOf :: Eq a => Query a -> [a] -> Query Bool
|
||||||
|
isOneOf q = fmap or . traverse (q =?)
|
||||||
|
|
||||||
|
isFocused :: Query Bool
|
||||||
|
isFocused = fmap not isUnfocused
|
||||||
|
|
||||||
isFirefoxPIP :: Query Bool
|
isFirefoxPIP :: Query Bool
|
||||||
isFirefoxPIP =
|
isFirefoxPIP =
|
||||||
className =? "firefox"
|
className =? "firefox"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue