forked from colonelpanic/dotfiles
[XMonad] Make gaps an arbitrary X action
This commit is contained in:
parent
b20b02993e
commit
67f2c87ca1
@ -221,22 +221,29 @@ data MyToggles
|
|||||||
|
|
||||||
instance Transformer MyToggles Window where
|
instance Transformer MyToggles Window where
|
||||||
transform LIMIT x k = k (limitSlice 2 x) unmodifyLayout
|
transform LIMIT x k = k (limitSlice 2 x) unmodifyLayout
|
||||||
transform GAPS x k = k (smartSpacing 5 x) unmodifyLayout
|
|
||||||
transform MAGICFOCUS x k = k (magicFocus x) unmodifyLayout
|
transform MAGICFOCUS x k = k (magicFocus x) unmodifyLayout
|
||||||
|
|
||||||
myToggles = [LIMIT, GAPS, MAGICFOCUS]
|
myToggles = [LIMIT, MAGICFOCUS]
|
||||||
otherToggles = [NBFULL, MIRROR]
|
otherToggles = [NBFULL, MIRROR]
|
||||||
|
|
||||||
followIfNoMagicFocus =
|
followIfNoMagicFocus =
|
||||||
followOnlyIf $ maybe False not <$> isToggleActive MAGICFOCUS
|
followOnlyIf $ maybe False not <$> isToggleActive MAGICFOCUS
|
||||||
|
|
||||||
togglesMap =
|
layoutTogglesMap =
|
||||||
fmap M.fromList $ sequence $
|
fmap M.fromList $ sequence $
|
||||||
map toggleTuple myToggles ++ map toggleTuple otherToggles
|
map toggleTuple myToggles ++ map toggleTuple otherToggles
|
||||||
where
|
where
|
||||||
toggleTuple toggle =
|
toggleTuple toggle =
|
||||||
fmap (\str -> (str, Toggle toggle)) (toggleToStringWithState toggle)
|
fmap (\str -> (str, Toggle toggle)) (toggleToStringWithState toggle)
|
||||||
|
|
||||||
|
togglesXActionsMap =
|
||||||
|
M.fromList [ ("GAPS", sendMessage $ ModifySpacing toggleSpacing ) ]
|
||||||
|
where toggleSpacing 0 = 10
|
||||||
|
toggleSpacing _ = 0
|
||||||
|
|
||||||
|
togglesMap =
|
||||||
|
M.union (M.map Left togglesXActionsMap) . M.map Right <$>
|
||||||
|
layoutTogglesMap
|
||||||
|
|
||||||
toggleStateToString s =
|
toggleStateToString s =
|
||||||
case s of
|
case s of
|
||||||
@ -251,7 +258,10 @@ toggleToStringWithState toggle =
|
|||||||
|
|
||||||
selectToggle =
|
selectToggle =
|
||||||
togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
|
togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
|
||||||
flip whenJust sendMessage
|
flip whenJust handleToggle
|
||||||
|
where
|
||||||
|
handleToggle (Left action) = action
|
||||||
|
handleToggle (Right toggle) = sendMessage toggle
|
||||||
|
|
||||||
toggleInState :: (Transformer t Window) => t -> Maybe Bool -> X Bool
|
toggleInState :: (Transformer t Window) => t -> Maybe Bool -> X Bool
|
||||||
toggleInState t s = fmap (/= s) (isToggleActive t)
|
toggleInState t s = fmap (/= s) (isToggleActive t)
|
||||||
@ -309,9 +319,9 @@ myLayoutHook =
|
|||||||
boringAuto .
|
boringAuto .
|
||||||
mkToggle1 MIRROR .
|
mkToggle1 MIRROR .
|
||||||
mkToggle1 LIMIT .
|
mkToggle1 LIMIT .
|
||||||
mkToggle1 GAPS .
|
|
||||||
mkToggle1 MAGICFOCUS .
|
mkToggle1 MAGICFOCUS .
|
||||||
mkToggle1 NBFULL .
|
mkToggle1 NBFULL .
|
||||||
|
smartSpacing 10 .
|
||||||
workspaceNamesHook .
|
workspaceNamesHook .
|
||||||
lessBorders Screen $ fst layoutInfo
|
lessBorders Screen $ fst layoutInfo
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user