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