Skip to content

Instantly share code, notes, and snippets.

@Brettm12345
Created December 6, 2019 06:31
Show Gist options
  • Save Brettm12345/28f3ea6d178b7db150b25df25ee9f7c2 to your computer and use it in GitHub Desktop.
Save Brettm12345/28f3ea6d178b7db150b25df25ee9f7c2 to your computer and use it in GitHub Desktop.
WIndow keybinds
module Bind.Keys.Windows
( windows
)
where
import XMonad.Actions.Promote ( promote )
import Bind.Keys.Internal ( Keymap
, subKeys
, zipKeys
, directionKeys
, directions
)
import XMonad.Actions.CopyWindow ( kill1 )
import qualified XMonad
import XMonad ( X )
import XMonad.Actions.Navigation2D ( Direction2D )
import XMonad.StackSet ( focusUp
, focusDown
, focusMaster
)
import qualified XMonad.Actions.Navigation2D as Nav2D
wrapNav :: Bool
wrapNav = True
shouldWrap :: (Direction2D -> Bool -> X ()) -> Direction2D -> X ()
shouldWrap = flip flip wrapNav
windowGo, windowSwap :: Direction2D -> X ()
windowGo = shouldWrap Nav2D.windowGo
windowSwap = shouldWrap Nav2D.windowSwap
windows :: Keymap l
windows = subKeys
"Windows"
( [ ("M-w" , "Kill" , kill1)
, ("M-<Tab>" , "Swap window focus up" , XMonad.windows focusUp)
, ("M-S-<Tab>", "Swap window focus down", XMonad.windows focusDown)
, ("M-m", "Focus the master window", XMonad.windows focusMaster)
, ("M-S-m" , "Promote current window to master", promote)
]
++ concatMap
(zipKeys directionKeys directions)
[("M-", "Focus window", windowGo), ("M-S-", "Swap window", windowSwap)]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment