forked from colonelpanic/dotfiles
[XMonad] Rewrite selects without do notation
This commit is contained in:
parent
f0c551d3d7
commit
8f4632d4ae
@ -91,9 +91,8 @@ myManageHook = composeAll . concat $
|
|||||||
-- Toggles
|
-- Toggles
|
||||||
unmodifyLayout (ModifiedLayout _ x') = x'
|
unmodifyLayout (ModifiedLayout _ x') = x'
|
||||||
|
|
||||||
selectLimit = do
|
selectLimit = DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"] >>=
|
||||||
result <- DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"]
|
(setLimit . read)
|
||||||
setLimit $ read result
|
|
||||||
|
|
||||||
data MyToggles = LIMIT
|
data MyToggles = LIMIT
|
||||||
| GAPS
|
| GAPS
|
||||||
@ -121,10 +120,8 @@ toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String
|
|||||||
toggleToStringWithState toggle = (printf "%s (%s)" (show toggle) . toggleStateToString) <$>
|
toggleToStringWithState toggle = (printf "%s (%s)" (show toggle) . toggleStateToString) <$>
|
||||||
isToggleActive toggle
|
isToggleActive toggle
|
||||||
|
|
||||||
selectToggle = do
|
selectToggle = togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
|
||||||
dmenuMap <- togglesMap
|
flip whenJust sendMessage
|
||||||
Just selectedToggle <- DM.menuMapArgs "rofi" ["-dmenu", "-i"] dmenuMap
|
|
||||||
sendMessage selectedToggle
|
|
||||||
|
|
||||||
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)
|
||||||
@ -163,9 +160,8 @@ layoutList = snd layoutInfo
|
|||||||
|
|
||||||
layoutNames = [description layout | layout <- layoutList]
|
layoutNames = [description layout | layout <- layoutList]
|
||||||
|
|
||||||
selectLayout = do
|
selectLayout = DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>=
|
||||||
selectedLayout <- DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames
|
(sendMessage . JumpToLayout)
|
||||||
sendMessage $ JumpToLayout selectedLayout
|
|
||||||
|
|
||||||
myLayoutHook = avoidStruts . minimize . boringAuto . mkToggle1 MIRROR .
|
myLayoutHook = avoidStruts . minimize . boringAuto . mkToggle1 MIRROR .
|
||||||
mkToggle1 LIMIT . mkToggle1 GAPS . mkToggle1 MAGICFOCUS .
|
mkToggle1 LIMIT . mkToggle1 GAPS . mkToggle1 MAGICFOCUS .
|
||||||
|
Loading…
Reference in New Issue
Block a user