forked from colonelpanic/dotfiles
[XMonad] Update bindBringAndRaise to have more behaviors
This commit is contained in:
parent
937d60f854
commit
bdc95c969b
@ -419,6 +419,10 @@ maximizedOtherClass =
|
|||||||
intersect <$> maximizedWindows <*>
|
intersect <$> maximizedWindows <*>
|
||||||
(currentWS >>= maybe (return []) windowsWithUnfocusedClass)
|
(currentWS >>= maybe (return []) windowsWithUnfocusedClass)
|
||||||
|
|
||||||
|
minimizedSameClass =
|
||||||
|
intersect <$> minimizedWindows <*>
|
||||||
|
(currentWS >>= maybe (return []) windowsWithFocusedClass)
|
||||||
|
|
||||||
getClassMatchesWindow w = (==) <$> getClass w
|
getClassMatchesWindow w = (==) <$> getClass w
|
||||||
getClassMatchesCurrent = join $ withFocusedD (`seq` False) getClassMatchesWindow
|
getClassMatchesCurrent = join $ withFocusedD (`seq` False) getClassMatchesWindow
|
||||||
|
|
||||||
@ -470,11 +474,16 @@ maybeUnminimizeClassAfter = (>> maximizeSameClassesInWorkspace)
|
|||||||
sameClassOnly action =
|
sameClassOnly action =
|
||||||
action >> minimizeOtherClassesInWorkspace >> maximizeSameClassesInWorkspace
|
action >> minimizeOtherClassesInWorkspace >> maximizeSameClassesInWorkspace
|
||||||
|
|
||||||
restoreAllMinimized = void $ join $ mapM maximizeWindow <$> minimizedWindows
|
restoreAll windows = mapM_ maximizeWindow windows
|
||||||
|
|
||||||
|
restoreAllMinimized = minimizedWindows >>= restoreAll
|
||||||
|
|
||||||
restoreOrMinimizeOtherClasses = null <$> maximizedOtherClass >>=
|
restoreOrMinimizeOtherClasses = null <$> maximizedOtherClass >>=
|
||||||
ifL restoreAllMinimized minimizeOtherClassesInWorkspace
|
ifL restoreAllMinimized minimizeOtherClassesInWorkspace
|
||||||
|
|
||||||
|
restoreThisClassOrMinimizeOtherClasses = minimizedSameClass >>= \windows ->
|
||||||
|
if' (null windows) minimizeOtherClassesInWorkspace $ restoreAll windows
|
||||||
|
|
||||||
getClassPair w = flip (,) w <$> getClass w
|
getClassPair w = flip (,) w <$> getClass w
|
||||||
|
|
||||||
windowClassPairs = withWindowSet $ mapM getClassPair . W.allWindows
|
windowClassPairs = withWindowSet $ mapM getClassPair . W.allWindows
|
||||||
@ -569,7 +578,7 @@ doScratchpad =
|
|||||||
-- Raise or spawn
|
-- Raise or spawn
|
||||||
|
|
||||||
myRaiseNextMaybe =
|
myRaiseNextMaybe =
|
||||||
((deactivateFullAnd . maybeUnminimizeClassAfter) .) .
|
((deactivateFullAnd . maybeUnminimizeAfter) .) .
|
||||||
raiseNextMaybeCustomFocus greedyFocusWindow
|
raiseNextMaybeCustomFocus greedyFocusWindow
|
||||||
|
|
||||||
myBringNextMaybe =
|
myBringNextMaybe =
|
||||||
@ -578,11 +587,13 @@ myBringNextMaybe =
|
|||||||
|
|
||||||
bindBringAndRaise :: KeyMask -> KeySym -> X () -> Query Bool -> [((KeyMask, KeySym), X ())]
|
bindBringAndRaise :: KeyMask -> KeySym -> X () -> Query Bool -> [((KeyMask, KeySym), X ())]
|
||||||
bindBringAndRaise mask sym start query =
|
bindBringAndRaise mask sym start query =
|
||||||
[ ((mask, sym), doRaiseNext)
|
[ ((mask, sym),
|
||||||
|
alreadyFocused >>= ifL restoreThisClassOrMinimizeOtherClasses doRaiseNext)
|
||||||
, ((mask .|. controlMask, sym), myBringNextMaybe start query)
|
, ((mask .|. controlMask, sym), myBringNextMaybe start query)
|
||||||
, ((mask .|. shiftMask, sym), doRaiseNext >> minimizeOtherClassesInWorkspace)
|
, ((mask .|. shiftMask, sym), doRaiseNext)
|
||||||
]
|
]
|
||||||
where doRaiseNext = myRaiseNextMaybe start query
|
where doRaiseNext = myRaiseNextMaybe start query
|
||||||
|
alreadyFocused = join $ withFocusedD False $ runQuery query
|
||||||
|
|
||||||
bindBringAndRaiseMany :: [(KeyMask, KeySym, X (), Query Bool)] -> [((KeyMask, KeySym), X())]
|
bindBringAndRaiseMany :: [(KeyMask, KeySym, X (), Query Bool)] -> [((KeyMask, KeySym), X())]
|
||||||
bindBringAndRaiseMany = concatMap (\(a, b, c, d) -> bindBringAndRaise a b c d)
|
bindBringAndRaiseMany = concatMap (\(a, b, c, d) -> bindBringAndRaise a b c d)
|
||||||
|
Loading…
Reference in New Issue
Block a user