Last active
August 5, 2022 12:53
-
-
Save LSLeary/399475bd7c5b063a5ff623730db64adb to your computer and use it in GitHub Desktop.
Modify an action to integrate it with RefocusLast.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ThenRefocusAfter where | |
import XMonad | |
import XMonad.Hooks.RefocusLast (refocusWhen) | |
import XMonad.Util.NamedScratchpad | |
(NamedScratchpads, query, namedScratchpadAction) | |
import qualified XMonad.StackSet as W | |
thenRefocusAfter :: Query Bool -> X a -> X a | |
p `thenRefocusAfter` act = do | |
tag <- gets (W.currentTag . windowset) | |
refocus <- refocusWhen p tag | |
act <* windows refocus | |
isScratchpad :: NamedScratchpads -> Query Bool | |
isScratchpad = foldr (\ns b -> query ns <||> b) (pure False) | |
namedScratchpadActionRL :: NamedScratchpads -> String -> X () | |
namedScratchpadActionRL nsps sp = | |
isScratchpad nsps `thenRefocusAfter` namedScratchpadAction nsps sp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also referenced here: https://gist.github.com/zim0369/87b4c1ff2572191ac17db32a09be3c07