summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-08-17 17:27:59 +0100
committerAlan Pearce2014-08-17 17:27:59 +0100
commitf438dd7973528c7ad204a7955257da0766571e97 (patch)
treef8ab13f8aa75de0e8f4000b68dc3d417b4784dde
parent9ddcdea56a49c1933ba7194c0aa87eb3589cf7ff (diff)
downloaddotfiles-f438dd7973528c7ad204a7955257da0766571e97.tar.lz
dotfiles-f438dd7973528c7ad204a7955257da0766571e97.tar.zst
dotfiles-f438dd7973528c7ad204a7955257da0766571e97.zip
XMonad: Make keybindings more Emacs-like
-rw-r--r--tag-xmonad/xmonad/xmonad.hs53
1 files changed, 53 insertions, 0 deletions
diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs
index 9e1fa77..c374844 100644
--- a/tag-xmonad/xmonad/xmonad.hs
+++ b/tag-xmonad/xmonad/xmonad.hs
@@ -1,11 +1,14 @@
 import XMonad
+import qualified XMonad.StackSet as W
 import XMonad.Hooks.DynamicLog
 import XMonad.Hooks.EwmhDesktops
 import XMonad.Hooks.ManageDocks
 import XMonad.Hooks.ManageHelpers
 import XMonad.Layout.NoBorders
+import XMonad.Layout.WindowNavigation
 import XMonad.Util.EZConfig
 import XMonad.Util.Run(spawnPipe)
+import System.Exit
 import System.IO
 import Data.List(isPrefixOf)
 
@@ -19,6 +22,55 @@ myManageHook = composeOne
                , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat
                ]
 
+myKeys c = mkKeymap c $
+           [ ("M-S-<Return>", spawn $ XMonad.terminal c)
+           , ("M-k", kill)
+
+           , ("M-x M-e", spawn "emacsclient -c")
+
+           , ("M-t",  withFocused $ windows . W.sink)
+           , ("M-m",  windows W.focusMaster)
+           , ("M-S-m",  windows W.swapMaster)
+
+           , ("M-<R>",    sendMessage $ Go R)
+           , ("M-<L>",    sendMessage $ Go L)
+           , ("M-<U>",    sendMessage $ Go U)
+           , ("M-<D>",    sendMessage $ Go D)
+           , ("M-M1-<R>", sendMessage $ Swap R)
+           , ("M-M1-<L>", sendMessage $ Swap L)
+           , ("M-M1-<U>", sendMessage $ Swap U)
+           , ("M-M1-<D>", sendMessage $ Swap D)
+           , ("M-C-<R>",  sendMessage $ Move R)
+           , ("M-C-<L>",  sendMessage $ Move L)
+           , ("M-C-<U>",  sendMessage $ Move U)
+           , ("M-C-<D>",  sendMessage $ Move D)
+
+           , ("M-n", windows W.focusDown)
+           , ("M-p", windows W.focusUp)
+           , ("M-S-n", windows W.swapDown)
+           , ("M-S-p", windows W.swapUp)
+
+           , ("M-,", sendMessage (IncMasterN 1))
+           , ("M-.", sendMessage (IncMasterN (-1)))
+
+           , ("M-\\", sendMessage NextLayout)
+           , ("M-S-\\", setLayout $ XMonad.layoutHook c)
+
+           , ("M-+", sendMessage Shrink)
+           , ("M--", sendMessage Expand)
+
+           , ("M-q", broadcastMessage ReleaseResources
+                         >> restart "xmonad" True)
+           , ("C-M-q", io (exitWith ExitSuccess))
+           ] ++
+
+             -- mod-[1..9], Switch to workspace N
+             -- mod-shift-[1..9], Move client to workspace N
+           [(m ++ k, windows $ f w)
+            | (w, k) <- zip (XMonad.workspaces c) (map show [1..9])
+            , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]]
+
+
 main :: IO ()
 main = do
   xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc"
@@ -35,4 +87,5 @@ main = do
              , terminal = "urxvt"
              , modMask = mod4Mask
              , handleEventHook = fullscreenEventHook
+             , keys = myKeys
   }