forked from colonelpanic/dotfiles
[XMonad] Add minimize toggling, reenable boring support
This commit is contained in:
parent
1067bbb0b6
commit
6594153d24
@ -4,7 +4,7 @@ packages:
|
|||||||
- '.'
|
- '.'
|
||||||
- location:
|
- location:
|
||||||
git: git@github.com:IvanMalison/xmonad-contrib.git
|
git: git@github.com:IvanMalison/xmonad-contrib.git
|
||||||
commit: 8a351cec6166f6411de0fd4041f52fd522e4f30f
|
commit: fb992e96af0d2af4344e3592d179242e72b01fca
|
||||||
- location:
|
- location:
|
||||||
git: git@github.com:IvanMalison/taffybar.git
|
git: git@github.com:IvanMalison/taffybar.git
|
||||||
commit: 39e3a95e9c2eae37ff8b67eaa31bbd18503859b1
|
commit: 39e3a95e9c2eae37ff8b67eaa31bbd18503859b1
|
||||||
|
@ -17,6 +17,7 @@ import Text.Printf
|
|||||||
import XMonad hiding ( (|||) )
|
import XMonad hiding ( (|||) )
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
import qualified XMonad.Actions.DynamicWorkspaceOrder as DWO
|
import qualified XMonad.Actions.DynamicWorkspaceOrder as DWO
|
||||||
|
import XMonad.Actions.Minimize
|
||||||
import XMonad.Actions.WindowBringer
|
import XMonad.Actions.WindowBringer
|
||||||
import XMonad.Actions.WindowGo
|
import XMonad.Actions.WindowGo
|
||||||
import XMonad.Actions.WorkspaceNames
|
import XMonad.Actions.WorkspaceNames
|
||||||
@ -88,9 +89,7 @@ layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full |||
|
|||||||
Tall 1 (3/100) (1/2) ||| magicFocus (Tall 1 (3/100) (3/4)) |||
|
Tall 1 (3/100) (1/2) ||| magicFocus (Tall 1 (3/100) (3/4)) |||
|
||||||
limitWindows 2 (Tall 1 (3/100) (1/2))
|
limitWindows 2 (Tall 1 (3/100) (1/2))
|
||||||
|
|
||||||
myLayoutHook = avoidStruts . smartSpacing 10 . minimize .
|
myLayoutHook = avoidStruts . smartSpacing 10 . minimize . boringAuto .
|
||||||
-- TODO: boring windows does not seem to work
|
|
||||||
-- boringAuto . boringWindows .
|
|
||||||
mkToggle (MIRROR ?? EOT) . workspaceNamesHook .
|
mkToggle (MIRROR ?? EOT) . workspaceNamesHook .
|
||||||
smartBorders . noBorders $ layouts
|
smartBorders . noBorders $ layouts
|
||||||
|
|
||||||
@ -134,9 +133,9 @@ getClassRemap = do
|
|||||||
setWorkspaceNameToFocusedWindow workspace = do
|
setWorkspaceNameToFocusedWindow workspace = do
|
||||||
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
||||||
renamedWindows <- remapNames namedWindows
|
renamedWindows <- remapNames namedWindows
|
||||||
WorkspaceNames namesMap <- XS.get
|
getWSName <- getWorkspaceNames'
|
||||||
let newName = intercalate "|" renamedWindows
|
let newName = intercalate "|" renamedWindows
|
||||||
currentName = M.findWithDefault "" (W.tag workspace) namesMap
|
currentName = fromMaybe "" (getWSName (W.tag workspace))
|
||||||
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
|
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
|
||||||
|
|
||||||
remapNames namedWindows = do
|
remapNames namedWindows = do
|
||||||
@ -157,15 +156,13 @@ workspaceNamesHook = ModifiedLayout WorkspaceNamesHook
|
|||||||
-- EWMH support for workspace names
|
-- EWMH support for workspace names
|
||||||
|
|
||||||
ewmhWorkspaceNamesLogHook = do
|
ewmhWorkspaceNamesLogHook = do
|
||||||
WorkspaceNames namesMap <- XS.get
|
getWSName <- getWorkspaceNames'
|
||||||
let tagRemapping = getWorkspaceNameFromTag namesMap
|
let tagRemapping = getWorkspaceNameFromTag getWSName
|
||||||
pagerHintsLogHookCustom tagRemapping
|
pagerHintsLogHookCustom tagRemapping
|
||||||
ewmhDesktopsLogHookCustom id tagRemapping
|
ewmhDesktopsLogHookCustom id tagRemapping
|
||||||
|
|
||||||
getWorkspaceNameFromTag namesMap tag =
|
getWorkspaceNameFromTag getWSName tag =
|
||||||
case M.lookup tag namesMap of
|
printf "%s: %s " tag (fromMaybe "(Empty)" (getWSName tag))
|
||||||
Nothing -> tag
|
|
||||||
Just label -> printf "%s: %s " tag label
|
|
||||||
|
|
||||||
-- Toggleable fade
|
-- Toggleable fade
|
||||||
|
|
||||||
@ -195,10 +192,12 @@ toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
|
|||||||
|
|
||||||
-- Minimize not in class
|
-- Minimize not in class
|
||||||
|
|
||||||
|
restoreFocus action = withFocused $ \orig -> action >> windows (W.focusWindow orig)
|
||||||
|
|
||||||
withWorkspace f = withWindowSet $ \ws ->
|
withWorkspace f = withWindowSet $ \ws ->
|
||||||
maybe (return ()) f (W.stack . W.workspace . W.current $ ws)
|
maybe (return ()) f (W.stack . W.workspace . W.current $ ws)
|
||||||
|
|
||||||
minimizeOtherClassesInWorkspace =
|
minimizeOtherClassesInWorkspace = restoreFocus $
|
||||||
withWorkspace (windowsWithUnfocusedClass >=> mapM_ minimizeWindow)
|
withWorkspace (windowsWithUnfocusedClass >=> mapM_ minimizeWindow)
|
||||||
|
|
||||||
windowsWithUnfocusedClass ws = windowsWithOtherClasses ws (W.focus ws)
|
windowsWithUnfocusedClass ws = windowsWithOtherClasses ws (W.focus ws)
|
||||||
@ -208,8 +207,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)
|
||||||
|
|
||||||
restoreAllMinimized =
|
restoreAllMinimized = restoreFocus $
|
||||||
withWorkspace $ mapM_ (sendMessage . RestoreMinimizedWin) . W.integrate
|
withLastMinimized $ \w -> maximizeWindow w >> restoreAllMinimized
|
||||||
|
|
||||||
|
restoreOrMinimizeOtherClasses = withLastMinimized' $ \mw ->
|
||||||
|
case mw of
|
||||||
|
Just _ -> restoreAllMinimized
|
||||||
|
Nothing -> minimizeOtherClassesInWorkspace
|
||||||
|
|
||||||
|
|
||||||
-- Window switching
|
-- Window switching
|
||||||
@ -222,7 +226,6 @@ greedyFocusWindow w ws = W.focusWindow w $ W.greedyView
|
|||||||
shiftThenView i = W.greedyView i . W.shift i
|
shiftThenView i = W.greedyView i . W.shift i
|
||||||
|
|
||||||
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
|
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
|
||||||
|
|
||||||
|
|
||||||
-- Raise or spawn
|
-- Raise or spawn
|
||||||
|
|
||||||
@ -256,10 +259,10 @@ addKeys conf@XConfig {modMask = modm} =
|
|||||||
, ((modm, xK_backslash), toggleWS)
|
, ((modm, xK_backslash), toggleWS)
|
||||||
|
|
||||||
-- TODO: there seems to be a bug with these bindings
|
-- TODO: there seems to be a bug with these bindings
|
||||||
-- -- Rebind these for boringWindows
|
-- Rebind these for boringWindows
|
||||||
-- , ((modm, xK_j), focusUp)
|
, ((modm, xK_j), focusDown)
|
||||||
-- , ((modm, xK_k), focusDown)
|
, ((modm, xK_k), focusUp)
|
||||||
-- , ((modm, xK_m), focusMaster)
|
, ((modm, xK_m), focusMaster)
|
||||||
|
|
||||||
-- Hyper bindings
|
-- Hyper bindings
|
||||||
, ((mod3Mask, xK_1), toggleFadingForActiveWindow)
|
, ((mod3Mask, xK_1), toggleFadingForActiveWindow)
|
||||||
@ -272,7 +275,7 @@ addKeys conf@XConfig {modMask = modm} =
|
|||||||
|
|
||||||
-- ModAlt bindings
|
-- ModAlt bindings
|
||||||
, ((modalt, xK_w), spawn "rofi_wallpaper.sh")
|
, ((modalt, xK_w), spawn "rofi_wallpaper.sh")
|
||||||
, ((modalt, xK_space), minimizeOtherClassesInWorkspace)
|
, ((modalt, xK_space), restoreOrMinimizeOtherClasses)
|
||||||
, ((modalt, xK_Return), restoreAllMinimized)
|
, ((modalt, xK_Return), restoreAllMinimized)
|
||||||
|
|
||||||
-- playerctl
|
-- playerctl
|
||||||
|
Loading…
Reference in New Issue
Block a user