aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-16 12:33:16 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-16 12:33:16 +0530
commitb83cd9c6c94b4f04b3da5aedb22c59a009c13e99 (patch)
treecd938f87bb056b5c437949f7fdb7e330d7c7db2f
parentbb0180c3413383b8a9c01168981c2d11a682942d (diff)
added some actions to handle windows and workspaces
-rw-r--r--xmonad.hs48
1 files changed, 33 insertions, 15 deletions
diff --git a/xmonad.hs b/xmonad.hs
index 5738bd2a..bd87f033 100644
--- a/xmonad.hs
+++ b/xmonad.hs
@@ -1,15 +1,20 @@
import XMonad
import qualified XMonad.StackSet as W
+import XMonad hiding ((|||))
-- actions
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
-import XMonad.Actions.CopyWindow (kill1)
+import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleWS
import XMonad.Actions.Navigation2D
+import XMonad.Actions.CycleSelectedLayouts
+import XMonad.Actions.GridSelect
+import XMonad.Actions.SwapWorkspaces
-- layouts modifiers
import XMonad.Layout.Spacing
import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LayoutCombinators ((|||))
-- import XMonad.Layout.Gaps
-- import XMonad.Layout.ShowWName
@@ -21,6 +26,9 @@ import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
+-- hooks
+import XMonad.Hooks.SetWMName
+
-- utilities
import XMonad.Util.SpawnOnce
import XMonad.Util.EZConfig (additionalKeys)
@@ -33,6 +41,7 @@ myStartupHook = do
spawnOnce "deadd-notification-center &"
-- spawnOnce "firefox &"
spawnOnce "sxhkd &"
+ setWMName "XMonad"
@@ -64,13 +73,10 @@ fBorder = "#FB027F"
myBorderWidth = 2
-
-windowGaps = mySpacing 2 3
-
myExtraWorkspaces = [(xK_0, "10")] -- ,(xK_minus, "tmp"),(xK_equal, "swap")]
-myWorkspaces = ["1","2","3","4","5","6","7","8","9"] ++ (map snd myExtraWorkspaces)
+myWorkspaces = ["1","2","3","4","5","6","7","8", "9"] ++ (map snd myExtraWorkspaces)
-myLayoutHook = windowGaps
+myLayoutHook = windowGaps 2 3
@@ -78,7 +84,7 @@ myLayoutHook = windowGaps
-- functions
-mySpacing i j = spacingRaw False (Border i i i i) True (Border j j j j) True $
+windowGaps i j = spacingRaw False (Border i i i i) True (Border j j j j) True $
layoutHook def
-- ~functions~
@@ -95,15 +101,15 @@ myKeys = [
((mod1Mask, xK_w), kill1),
((mod1Mask .|. shiftMask, xK_k), kill1),
- -- view prev/next workspaces
+ -- view prev/next workspaces
((mod1Mask, xK_h), prevWS),
((mod1Mask, xK_l), nextWS),
- -- move to prev/next workspaces
+ -- move to prev/next workspaces
((mod1Mask .|. shiftMask, xK_h), shiftToPrev >> prevWS),
((mod1Mask .|. shiftMask, xK_l), shiftToNext >> nextWS),
- -- modify gaps on runtime
+ -- modify gaps on runtime
((mod1Mask, xK_equal), incWindowSpacing 1),
((mod1Mask, xK_minus), decWindowSpacing 1),
((mod1Mask .|. shiftMask, xK_equal), incScreenSpacing 1),
@@ -111,23 +117,35 @@ myKeys = [
((mod4Mask .|. shiftMask, xK_Return), windows W.swapMaster), -- Swap the focused window and the master window
- -- Directional navigation of windows
+ -- directional navigation of windows
((mod4Mask, xK_l), windowGo R False),
((mod4Mask, xK_h), windowGo L False),
((mod4Mask, xK_k), windowGo U False),
((mod4Mask, xK_j), windowGo D False),
- -- Swap adjacent windows
+ -- swap adjacent windows
((mod4Mask .|. shiftMask, xK_l), windowSwap R False),
((mod4Mask .|. shiftMask, xK_h), windowSwap L False),
((mod4Mask .|. shiftMask, xK_k), windowSwap U False),
((mod4Mask .|. shiftMask, xK_j), windowSwap D False),
- -- cycle through windows
+ -- cycle through windows
((mod1Mask, xK_j), windows W.focusDown),
- ((mod1Mask, xK_k), windows W.focusUp)
+ ((mod1Mask, xK_k), windows W.focusUp),
+
+ -- grid select
+ ((mod1Mask, xK_n), goToSelected defaultGSConfig)
+
+ ] ++ [ -- for extra workspace(s)
+ ((myModMask, key), (windows $ W.greedyView ws))
+ | (key,ws) <- myExtraWorkspaces
+ ] ++ [
+ ((myModMask .|. shiftMask, key), (windows $ W.shift ws))
+ | (key,ws) <- myExtraWorkspaces
+ ] ++ [ -- to swap workspaces
+ ((mod4Mask .|. controlMask, k), windows $ swapWithCurrent i)
+ | (i, k) <- zip myWorkspaces [xK_1 ..]]
- ]
-- ~keybindings~