[Xmonad] Add selectLimit and keybinding

This commit is contained in:
Ivan Malison 2016-11-11 16:13:16 -08:00
parent a5e5ad867c
commit 27bb824394
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -38,7 +38,7 @@ import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Util.CustomKeys import XMonad.Util.CustomKeys
import XMonad.Util.Dmenu (menuMapArgs) import qualified XMonad.Util.Dmenu as DM
import qualified XMonad.Util.ExtensibleState as XS import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.Minimize import XMonad.Util.Minimize
import XMonad.Util.NamedWindows (getName) import XMonad.Util.NamedWindows (getName)
@ -87,6 +87,10 @@ myManageHook = composeAll . concat $
-- Toggles -- Toggles
unmodifyLayout (ModifiedLayout _ x') = x' unmodifyLayout (ModifiedLayout _ x') = x'
selectLimit = do
result <- DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"]
setLimit $ read result
data MyToggles = LIMIT data MyToggles = LIMIT
| GAPS | GAPS
| MAGICFOCUS | MAGICFOCUS
@ -102,7 +106,7 @@ myToggles = [LIMIT, GAPS, MAGICFOCUS]
togglesMap = M.fromList [(show toggle, toggle) | toggle <- myToggles] togglesMap = M.fromList [(show toggle, toggle) | toggle <- myToggles]
selectToggle = do selectToggle = do
Just selectedToggle <- menuMapArgs "rofi" ["-dmenu", "-i"] togglesMap Just selectedToggle <- DM.menuMapArgs "rofi" ["-dmenu", "-i"] togglesMap
sendMessage $ Toggle selectedToggle sendMessage $ Toggle selectedToggle
-- Layout setup -- Layout setup
@ -317,6 +321,7 @@ addKeys conf@XConfig {modMask = modm} =
, ((modm .|. controlMask, xK_space), sendMessage $ JumpToLayout "Full") , ((modm .|. controlMask, xK_space), sendMessage $ JumpToLayout "Full")
, ((modm, xK_slash), sendMessage $ Toggle MIRROR) , ((modm, xK_slash), sendMessage $ Toggle MIRROR)
, ((modm, xK_5), selectToggle) , ((modm, xK_5), selectToggle)
, ((modm, xK_4), selectLimit)
, ((modm, xK_m), withFocused minimizeWindow) , ((modm, xK_m), withFocused minimizeWindow)
, ((modm .|. shiftMask, xK_m), restoreAllMinimized) , ((modm .|. shiftMask, xK_m), restoreAllMinimized)
, ((modm, xK_backslash), toggleWS) , ((modm, xK_backslash), toggleWS)