diff options
author | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-05-21 21:49:53 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-05-21 21:49:53 +0530 |
commit | 6b532ee9b5fa448e4d827fed83882f76c4f1871e (patch) | |
tree | d6b7f69e059c0decbfcf1b09fc2003a0f875548c /.config | |
parent | de1bba4cacc0dda1958852565a51173fe2995adc (diff) |
added mouse keybinding to move windows
Diffstat (limited to '.config')
-rw-r--r-- | .config/XMonad/lib/Keybindings.hs | 83 |
1 files changed, 37 insertions, 46 deletions
diff --git a/.config/XMonad/lib/Keybindings.hs b/.config/XMonad/lib/Keybindings.hs index 724a8a4..f076f52 100644 --- a/.config/XMonad/lib/Keybindings.hs +++ b/.config/XMonad/lib/Keybindings.hs @@ -1,13 +1,10 @@ module Keybindings where -import XMonad -import XMonad.Operations -import qualified XMonad.StackSet as W + import System.Exit import System.IO --- data -import Data.Tree -import qualified Data.Map as M +import XMonad +import qualified XMonad.StackSet as W -- actions import XMonad.Actions.CopyWindow @@ -15,30 +12,21 @@ import XMonad.Actions.WithAll import XMonad.Actions.CycleWS import XMonad.Actions.GridSelect import XMonad.Actions.SwapWorkspaces -import qualified XMonad.Actions.TreeSelect as TS -- layout modifiers import XMonad.Layout.Spacing import XMonad.Layout.WindowNavigation as WN import XMonad.Layout.Maximize -import XMonad.Layout.Fullscreen -import XMonad.Layout.NoBorders -- Layouts import XMonad.Layout.BinarySpacePartition as BSP -import XMonad.Layout.Grid -import XMonad.Layout.Tabbed -- hooks -import XMonad.Hooks.SetWMName import XMonad.Hooks.ManageDocks -import XMonad.Hooks.EwmhDesktops -- utilities -import XMonad.Util.Run import XMonad.Util.SpawnOnce import XMonad.Util.EZConfig -import XMonad.Util.Cursor import XMonad.Util.NamedScratchpad import Defaults @@ -46,8 +34,10 @@ import Scratchpads myMouseKeybindings :: [((ButtonMask, Button), Window -> X ())] myMouseKeybindings = [ - ((myModMask, 4), \w -> prevWS) - , ((myModMask, 5), \w -> nextWS) + ((myModMask, 4), \w -> prevWS) + , ((myModMask, 5), \w -> nextWS) + , ((myModShiftMask, 4), \w -> shiftToPrev >> prevWS) + , ((myModShiftMask, 5), \w -> shiftToNext >> nextWS) ] myKeybindings :: [((KeyMask, KeySym), X ())] @@ -78,7 +68,7 @@ myKeybindings = [ , ((myModMask .|. shiftMask, xK_F1), decScreenSpacing 1) -- view prev/next workspaces - , ((myModMask .|. shiftMask, xK_Tab ), prevWS) + , ((myModShiftMask, xK_Tab ), prevWS) , ((myModMask, xK_Tab ), nextWS) , ((myModMask, xK_semicolon ), prevWS) , ((myModMask, xK_apostrophe), nextWS) @@ -86,18 +76,18 @@ myKeybindings = [ , ((myModMask', xK_l ), nextWS) -- move to prev/next workspaces - , ((myModMask' .|. shiftMask, xK_h ), shiftToPrev >> prevWS) - , ((myModMask' .|. shiftMask, xK_l ), shiftToNext >> nextWS) - , ((myModMask .|. shiftMask, xK_semicolon ), shiftToPrev >> prevWS) - , ((myModMask .|. shiftMask, xK_apostrophe), shiftToNext >> nextWS) + , ((myModShiftMask', xK_h ), shiftToPrev >> prevWS) + , ((myModShiftMask', xK_l ), shiftToNext >> nextWS) + , ((myModShiftMask', xK_semicolon ), shiftToPrev >> prevWS) + , ((myModShiftMask', xK_apostrophe), shiftToNext >> nextWS) -- focus previous/next monitor , ((myModMask, xK_bracketleft ), prevScreen) , ((myModMask, xK_bracketright), nextScreen) -- move window to previous/next monitor - , ((myModMask .|. shiftMask, xK_bracketleft ), shiftPrevScreen >> prevScreen) - , ((myModMask .|. shiftMask, xK_bracketright), shiftNextScreen >> nextScreen) + , ((myModShiftMask, xK_bracketleft ), shiftPrevScreen >> prevScreen) + , ((myModShiftMask, xK_bracketright), shiftNextScreen >> nextScreen) -- swap different screens , ((myModMask .|. controlMask, xK_bracketleft ), swapPrevScreen) @@ -114,38 +104,38 @@ myKeybindings = [ , ((myModMask', xK_k), windows W.focusUp) -- 2D navigation - , ((myModMask, xK_l), sendMessage $ Go R) - , ((myModMask, xK_h), sendMessage $ Go L) - , ((myModMask, xK_k), sendMessage $ Go U) - , ((myModMask, xK_j), sendMessage $ Go D) + , ((myModMask, xK_l), sendMessage $ Go R) + , ((myModMask, xK_h), sendMessage $ Go L) + , ((myModMask, xK_k), sendMessage $ Go U) + , ((myModMask, xK_j), sendMessage $ Go D) -- swap windows - , ((myModMask .|. shiftMask, xK_l), sendMessage $ WN.Swap R) - , ((myModMask .|. shiftMask, xK_h), sendMessage $ WN.Swap L) - , ((myModMask .|. shiftMask, xK_k), sendMessage $ WN.Swap U) - , ((myModMask .|. shiftMask, xK_j), sendMessage $ WN.Swap D) + , ((myModShiftMask, xK_l), sendMessage $ WN.Swap R) + , ((myModShiftMask, xK_h), sendMessage $ WN.Swap L) + , ((myModShiftMask, xK_k), sendMessage $ WN.Swap U) + , ((myModShiftMask, xK_j), sendMessage $ WN.Swap D) -- resize - , ((myModMask .|. mod1Mask, xK_l), sendMessage $ ExpandTowards R) - , ((myModMask .|. mod1Mask, xK_h), sendMessage $ ExpandTowards L) - , ((myModMask .|. mod1Mask, xK_j), sendMessage $ ExpandTowards D) - , ((myModMask .|. mod1Mask, xK_k), sendMessage $ ExpandTowards U) - , ((myModMask .|. mod1Mask .|. shiftMask, xK_l), sendMessage $ ShrinkFrom R) - , ((myModMask .|. mod1Mask .|. shiftMask, xK_h), sendMessage $ ShrinkFrom L) - , ((myModMask .|. mod1Mask .|. shiftMask, xK_j), sendMessage $ ShrinkFrom D) - , ((myModMask .|. mod1Mask .|. shiftMask, xK_k), sendMessage $ ShrinkFrom U) + , ((myModMask .|. myModMask', xK_l), sendMessage $ ExpandTowards R) + , ((myModMask .|. myModMask', xK_h), sendMessage $ ExpandTowards L) + , ((myModMask .|. myModMask', xK_j), sendMessage $ ExpandTowards D) + , ((myModMask .|. myModMask', xK_k), sendMessage $ ExpandTowards U) + , ((myModMask .|. myModShiftMask', xK_l), sendMessage $ ShrinkFrom R) + , ((myModMask .|. myModShiftMask', xK_h), sendMessage $ ShrinkFrom L) + , ((myModMask .|. myModShiftMask', xK_j), sendMessage $ ShrinkFrom D) + , ((myModMask .|. myModShiftMask', xK_k), sendMessage $ ShrinkFrom U) ] ++ [ -- for extra workspace(s) ((myModMask, key), windows $ W.greedyView ws) | (key,ws) <- myExtraWorkspaces ] ++ [ -- also for extra workspaces - ((myModMask .|. shiftMask, key), windows $ W.shift ws) + ((myModShiftMask, key), windows $ W.shift ws) | (key,ws) <- myExtraWorkspaces ] ++ [ -- to swap workspace - ((mod1Mask .|. shiftMask, k), windows $ swapWithCurrent i) + ((myModShiftMask', k), windows $ swapWithCurrent i) | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] ] ++ [ -- copy ((m .|. myModMask, k), windows $ f i) | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] - , (f, m) <- [(copy, shiftMask .|. myModMask')] + , (f, m) <- [(copy, myModShiftMask')] ] ++ [ -- for not swapping tags while using multihead ((m .|. myModMask, k), windows $ f i) | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] @@ -216,6 +206,10 @@ myKeybindingsP = [ , ("M-q t", sendMessage ToggleStruts) , ("M-q s", sendMessage BSP.Swap) , ("M-q g", goToSelected myGridSelect) + , ("M-q c", windows copyToAll) + , ("M-q S-c", killAllOtherCopies) + , ("M-q b", bringSelected myGridSelect) + -- gaps , ("M-q x d", decWindowSpacing 3) , ("M-q x i", incWindowSpacing 3) , ("M-q x S-d", decScreenSpacing 3) @@ -226,9 +220,6 @@ myKeybindingsP = [ , ("M-q x S-n", setWindowSpacingEnabled True) , ("M-q x m", setScreenSpacingEnabled False) , ("M-q x S-m", setScreenSpacingEnabled True) - , ("M-q c", windows copyToAll) - , ("M-q S-c", killAllOtherCopies) - , ("M-q b", bringSelected myGridSelect) -- resize windows , ("M-q h", sendMessage $ ExpandTowards L) , ("M-q j", sendMessage $ ExpandTowards D) |