From f09ec7b7dbddd165ed9e62a64a2c017099457c84 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 14 Apr 2017 19:37:30 -0700 Subject: [PATCH] [XMonad] Add goFullscreenDWIM --- dotfiles/xmonad/xmonad.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dotfiles/xmonad/xmonad.hs b/dotfiles/xmonad/xmonad.hs index e582ed1e..ae2c7054 100644 --- a/dotfiles/xmonad/xmonad.hs +++ b/dotfiles/xmonad/xmonad.hs @@ -522,6 +522,13 @@ actOnWindowsInWorkspace :: (Window -> X ()) actOnWindowsInWorkspace windowAction getWindowsAction = restoreFocus $ withWorkspace (getWindowsAction >=> mapM_ windowAction) +goFullscreenDWIM = + withWorkspace $ \ws -> do + wins <- windowsWithFocusedClass ws + if length wins > 1 + then goFullscreen + else minimizeOtherClassesInWorkspace + windowsWithUnfocusedClass ws = windowsWithOtherClasses (W.focus ws) ws windowsWithFocusedClass ws = windowsWithSameClass (W.focus ws) ws windowsWithOtherClasses = windowsMatchingClassPredicate (/=) @@ -738,7 +745,7 @@ addKeys conf@XConfig { modMask = modm } = , ((modm, xK_g), myGoToWindow) , ((modm, xK_b), myBringWindow) , ((modm .|. shiftMask, xK_b), myReplaceWindow) - , ((modm .|. controlMask, xK_space), goFullscreen) + , ((modm .|. controlMask, xK_space), deactivateFullOr goFullscreenDWIM) , ((modm, xK_m), withFocused minimizeWindow) , ((modm .|. shiftMask, xK_m), deactivateFullOr $ withLastMinimized maximizeWindowAndFocus)