mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium/xmonad: rewrite dynamic hooks for composability
This commit is contained in:
parent
587b4a4e20
commit
9b1399e0e6
1 changed files with 24 additions and 16 deletions
|
|
@ -148,27 +148,35 @@ myManageHook =
|
||||||
]
|
]
|
||||||
<> namedScratchpadManageHook myScratchpads
|
<> namedScratchpadManageHook myScratchpads
|
||||||
|
|
||||||
|
-- TODO: is there a way to always open certain sites in new windows in firefox?
|
||||||
|
-- TODO: stop full screen when move happens
|
||||||
myEventHandleHook :: Event -> X All
|
myEventHandleHook :: Event -> X All
|
||||||
myEventHandleHook =
|
myEventHandleHook =
|
||||||
-- TODO: is there a way to always open certain sites in new windows in firefox?
|
-- If the title changes in the background, we don't want to greedy view that workspace.
|
||||||
-- TODO: stop full screen when move happens
|
-- Imagine Spotify playing in the background, a track change would focus that workspace.
|
||||||
onTitleChange $ composeAll
|
-- We prevent this by checking if the window is in the current workspace
|
||||||
[ isSpotify --> doShiftAndViewIfCurrent multimediaWS
|
onTitleChange
|
||||||
, isYouTube --> doShiftAndViewIfCurrent multimediaWS
|
$ (windowIsInCurrentWorkspace -->)
|
||||||
, isDiscord --> doShiftAndViewIfCurrent chatWS
|
$ composeAll
|
||||||
, isWhatsApp --> doShiftAndViewIfCurrent chatWS
|
[ isSpotify --> doShiftAndGreedyView multimediaWS
|
||||||
, isElement --> doShiftAndViewIfCurrent chatWS
|
, isYouTube --> doShiftAndGreedyView multimediaWS
|
||||||
|
, isDiscord --> doShiftAndGreedyView chatWS
|
||||||
|
, isWhatsApp --> doShiftAndGreedyView chatWS
|
||||||
|
, isElement --> doShiftAndGreedyView chatWS
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | If the title changes in the background, we don't want to greedy view that workspace.
|
doShiftAndGreedyView :: WorkspaceId -> Query (Endo WindowSet)
|
||||||
-- Imagine Spotify playing in the background, a track change would focus that workspace.
|
doShiftAndGreedyView n = doF . go =<< ask
|
||||||
-- We prevent this by checking if the window is in the current workspace
|
|
||||||
doShiftAndViewIfCurrent :: WorkspaceId -> Query (Endo WindowSet)
|
|
||||||
doShiftAndViewIfCurrent n = doF . go =<< ask
|
|
||||||
where go :: Window -> WindowSet -> WindowSet
|
where go :: Window -> WindowSet -> WindowSet
|
||||||
go w s = case W.findTag w s of
|
go w s = W.greedyView n $ W.shiftWin n w s
|
||||||
Just from | from == W.currentTag s -> W.greedyView n $ W.shiftWin n w s
|
|
||||||
_ -> s
|
hasProp :: (Window -> WindowSet -> Bool) -> Query Bool
|
||||||
|
hasProp f = f <$> ask <*> (liftX $ gets windowset)
|
||||||
|
|
||||||
|
windowIsInCurrentWorkspace :: Query Bool
|
||||||
|
windowIsInCurrentWorkspace = hasProp $ \w s -> case W.findTag w s of
|
||||||
|
Just from | from == W.currentTag s -> True
|
||||||
|
_ -> False
|
||||||
|
|
||||||
myStartupHook :: X ()
|
myStartupHook :: X ()
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue