From c00aecf24261ca501c6d0944e79b8655a18cc54e Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 1 May 2018 12:21:10 +0200 Subject: Restructure XMonad keybindings --- conf/xmonad/xmonad.hs | 81 +++++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/conf/xmonad/xmonad.hs b/conf/xmonad/xmonad.hs index 90897ce..6286177 100644 --- a/conf/xmonad/xmonad.hs +++ b/conf/xmonad/xmonad.hs @@ -19,6 +19,9 @@ import XMonad.Actions.GroupNavigation import System.Exit import Data.Maybe +workspaces :: [WorkspaceId] +workspaces = map show [1 .. 9 :: Int] + customTabTheme = (theme xmonadTheme) { fontName = "xft:Iosevka Medium-12" , decoHeight = 20 @@ -53,63 +56,71 @@ scratchpads = [ NS "terminal" "kitty --class=scratchterm" (className =? "scratch (customFloating floatRectCenter) , NS "browser" "firefox" (className =? "Firefox") (customFloating floatRectTop) - , NS "zeal" "zeal" (className =? "Zeal") + , NS "documentation" "zeal" (className =? "Zeal") (customFloating floatRectFull) - , NS "telegram" "telegram-desktop" (className =? "TelegramDesktop") + , NS "messaging" "telegram-desktop" (className =? "TelegramDesktop") (customFloating floatRectCenter) ] -main = xmonad $ ewmh - $ defaultConfig - { modMask = mod4Mask -- super key as modifier - , borderWidth = 3 - , normalBorderColor = "#161616" - , focusedBorderColor = "#909737" - , terminal = "kitty" - , handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook - , layoutHook = availableLayouts - , manageHook = namedScratchpadManageHook scratchpads - , logHook = historyHook } - `removeKeysP` - [ "M-S-", "M-q", "M-S-q", "M-S-c", "M-" ] - `additionalKeysP` +keybindings = -- xmonad session control [ ("C-M1-" , io (exitWith ExitSuccess)) , ("C-M1-" , spawn "xmonad --restart") -- application launchers - , ("M-p" , spawn "rofi -show combi") + , ("M-" , spawn "rofi -show combi") , ("M-" , spawn "kitty") , ("M-S-" , spawn "vim -g") -- window management , ("M-q" , windows $ shift "NSP") , ("M-S-q" , kill) - , ("M-S-m" , windows swapMaster) + , ("M-j" , windows focusDown) + , ("M-k" , windows focusUp) + , ("M-S-j" , windows swapDown) + , ("M-S-k" , windows swapUp) + , ("M-h" , sendMessage Shrink) + , ("M-l" , sendMessage Expand) , ("M-" , nextMatch History (return True)) -- window bringer , ("M-a" , gotoMenuConfig windowBringerDmenuConfig) , ("M-S-a" , bringMenuConfig windowBringerDmenuConfig) --- workspace management - , ("M-w l" , sendMessage NextLayout) - , ("M-w p" , toggleWS' ["NSP"]) - , ("M-w j" , moveTo Next nonEmptyWS) - , ("M-w k" , moveTo Prev nonEmptyWS) - , ("M-S-w j" , shiftTo Next nonEmptyWS >> moveTo Next nonEmptyWS) - , ("M-S-w k" , shiftTo Prev nonEmptyWS >> moveTo Prev nonEmptyWS) -- scratchpads - , ("M-s t" , namedScratchpadAction scratchpads "terminal") - , ("M-s b" , namedScratchpadAction scratchpads "browser") - , ("M-s h" , namedScratchpadAction scratchpads "zeal") - , ("M-s m" , namedScratchpadAction scratchpads "telegram") + , ("M-b" , namedScratchpadAction scratchpads "browser") + , ("M-d" , namedScratchpadAction scratchpads "documentation") + , ("M-m" , namedScratchpadAction scratchpads "messaging") ] ++ +-- workspace selection + [ (p ++ [k] , windows $ f i) | (i, k) <- zip Main.workspaces ['1' .. '9'] + , (p, f) <- [ ("M-", greedyView), ("M-S-", shift) ] ] ++ +-- workspace management + [ ("M-s l" , sendMessage NextLayout) + , ("M-s p" , toggleWS' ["NSP"]) + , ("M-s j" , moveTo Next nonEmptyWS) + , ("M-s k" , moveTo Prev nonEmptyWS) + , ("M-S-s j" , shiftTo Next nonEmptyWS >> moveTo Next nonEmptyWS) + , ("M-S-s k" , shiftTo Prev nonEmptyWS >> moveTo Prev nonEmptyWS) -- floating placement - , ("M-f f" , withFocused $ placeFloating floatRectFull) - , ("M-f c" , withFocused $ placeFloating floatRectCenter) - , ("M-f j" , withFocused $ placeFloating floatRectBottom) - , ("M-f k" , withFocused $ placeFloating floatRectTop) - , ("M-f h" , withFocused $ placeFloating floatRectLeft) - , ("M-f l" , withFocused $ placeFloating floatRectRight) + , ("M-w t" , withFocused $ windows . sink) + , ("M-w f" , withFocused $ placeFloating floatRectFull) + , ("M-w c" , withFocused $ placeFloating floatRectCenter) + , ("M-w j" , withFocused $ placeFloating floatRectBottom) + , ("M-w k" , withFocused $ placeFloating floatRectTop) + , ("M-w h" , withFocused $ placeFloating floatRectLeft) + , ("M-w l" , withFocused $ placeFloating floatRectRight) -- system control , ("M-c " , spawn "amixer sset Master 10%+") , ("M-c " , spawn "amixer sset Master 10%-") , ("M-c m" , spawn "amixer sset Master toggle") ] + +main = xmonad $ ewmh + $ defaultConfig + { modMask = mod4Mask -- super key as modifier + , borderWidth = 3 + , normalBorderColor = "#161616" + , focusedBorderColor = "#909737" + , keys = \c -> mkKeymap c keybindings + , startupHook = return () >> checkKeymap defaultConfig keybindings + , handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook + , layoutHook = availableLayouts + , manageHook = namedScratchpadManageHook scratchpads + , logHook = historyHook } `additionalKeys` [ ((noModMask, xK_Menu) , namedScratchpadAction scratchpads "terminal") ] -- cgit v1.2.3