[XMonad] Ensure that the focused window is not minimized

This commit is contained in:
Ivan Malison 2016-11-10 18:05:50 -08:00
parent 6594153d24
commit 684c2644a6
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -39,6 +39,7 @@ import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Util.CustomKeys import XMonad.Util.CustomKeys
import qualified XMonad.Util.ExtensibleState as XS import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.Minimize
import XMonad.Util.NamedWindows (getName) import XMonad.Util.NamedWindows (getName)
main = xmonad $ def main = xmonad $ def
@ -46,7 +47,8 @@ main = xmonad $ def
, terminal = "urxvt" , terminal = "urxvt"
, manageHook = manageDocks <+> myManageHook <+> manageHook def , manageHook = manageDocks <+> myManageHook <+> manageHook def
, layoutHook = myLayoutHook , layoutHook = myLayoutHook
, logHook = toggleFadeInactiveLogHook 0.9 +++ ewmhWorkspaceNamesLogHook , logHook = toggleFadeInactiveLogHook 0.9 +++ ewmhWorkspaceNamesLogHook +++
maybeUnminimizeFocused
, handleEventHook = docksEventHook <+> fullscreenEventHook +++ , handleEventHook = docksEventHook <+> fullscreenEventHook +++
ewmhDesktopsEventHook +++ pagerHintsEventHook ewmhDesktopsEventHook +++ pagerHintsEventHook
, startupHook = myStartup +++ ewmhWorkspaceNamesLogHook , startupHook = myStartup +++ ewmhWorkspaceNamesLogHook
@ -73,7 +75,8 @@ virtualClasses = [ (hangoutsSelector, "Hangouts")
, (transmissionSelector, "Transmission") , (transmissionSelector, "Transmission")
] ]
-- Startup hoo -- Startup hook
myStartup = spawn "systemctl --user start wm.target" myStartup = spawn "systemctl --user start wm.target"
-- Manage hook -- Manage hook
@ -188,7 +191,6 @@ toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
let existingValue = M.findWithDefault True window toggleMap let existingValue = M.findWithDefault True window toggleMap
XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap) XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap)
return () return ()
-- Minimize not in class -- Minimize not in class
@ -207,6 +209,13 @@ windowsWithOtherClasses workspace window = do
let predicate = (/= windowClass) let predicate = (/= windowClass)
filterM (\w -> predicate <$> getClass w) (W.integrate workspace) filterM (\w -> predicate <$> getClass w) (W.integrate workspace)
windowIsMinimized w = do
minimized <- XS.gets minimizedStack
return $ w `elem` minimized
maybeUnminimizeFocused = withFocused $ \w ->
windowIsMinimized w >>= flip when (maximizeWindow w)
restoreAllMinimized = restoreFocus $ restoreAllMinimized = restoreFocus $
withLastMinimized $ \w -> maximizeWindow w >> restoreAllMinimized withLastMinimized $ \w -> maximizeWindow w >> restoreAllMinimized
@ -258,8 +267,7 @@ addKeys conf@XConfig {modMask = modm} =
, ((modm .|. shiftMask, xK_m), restoreAllMinimized) , ((modm .|. shiftMask, xK_m), restoreAllMinimized)
, ((modm, xK_backslash), toggleWS) , ((modm, xK_backslash), toggleWS)
-- TODO: there seems to be a bug with these bindings -- These need to be rebound to support boringWindows
-- Rebind these for boringWindows
, ((modm, xK_j), focusDown) , ((modm, xK_j), focusDown)
, ((modm, xK_k), focusUp) , ((modm, xK_k), focusUp)
, ((modm, xK_m), focusMaster) , ((modm, xK_m), focusMaster)