aboutsummaryrefslogtreecommitdiff
path: root/xmonad.hs
blob: bd87f0332db582315c194440307039c2c7549fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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
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

-- Layouts
import XMonad.Layout.GridVariants (Grid(Grid))
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Spiral
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)


myStartupHook :: X ()
myStartupHook = do
          spawnOnce "nitrogen --restore &"
          spawnOnce "picom &"
          spawnOnce "deadd-notification-center &"
--           spawnOnce "firefox &"
          spawnOnce "sxhkd &"
          setWMName "XMonad"





-- defaults

-- myFont :: String
-- myFont = "Roboto"

myModMask :: KeyMask
myModMask = mod4Mask 

myTerminal :: String
myTerminal = "st"

myBrowser :: String
myBrowser = "firefox"

-- myEditor :: String
-- myEditor = "vim"

-- ~defaults~

-- wm variables

nBorder = "#bf00ff"
fBorder = "#FB027F"

myBorderWidth = 2

myExtraWorkspaces = [(xK_0, "10")] -- ,(xK_minus, "tmp"),(xK_equal, "swap")]
myWorkspaces = ["1","2","3","4","5","6","7","8", "9"] ++ (map snd myExtraWorkspaces)

myLayoutHook = windowGaps 2 3



-- ~wm variables~

-- functions

windowGaps i j = spacingRaw False (Border i i i i) True (Border j j j j) True $
            layoutHook def

-- ~functions~

-- keybindings

notMyKeys = [  -- removed keybindings
            (mod4Mask, xK_Return)
            ]


myKeys = [
         ((mod4Mask, xK_Return), spawn myTerminal),
         ((mod1Mask, xK_w), kill1),
         ((mod1Mask .|. shiftMask, xK_k), kill1),

         -- view prev/next workspaces
         ((mod1Mask, xK_h), prevWS),
         ((mod1Mask, xK_l), nextWS),

         -- move to prev/next workspaces
         ((mod1Mask .|. shiftMask, xK_h), shiftToPrev >> prevWS),
         ((mod1Mask .|. shiftMask, xK_l), shiftToNext >> nextWS),

         -- modify gaps on runtime
         ((mod1Mask, xK_equal), incWindowSpacing 1),
         ((mod1Mask, xK_minus), decWindowSpacing 1),
         ((mod1Mask .|. shiftMask, xK_equal), incScreenSpacing 1),  
         ((mod1Mask .|. shiftMask, xK_minus), decScreenSpacing 1), 
         
         ((mod4Mask .|. shiftMask, xK_Return), windows W.swapMaster), -- Swap the focused window and the master window

         -- 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
         ((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 
         ((mod1Mask, xK_j), windows W.focusDown),
         ((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~


main = do
  xmonad $ def
    {
  terminal           = myTerminal,
  focusFollowsMouse  = True,
  borderWidth        = myBorderWidth,
  modMask            = myModMask,
  workspaces         = myWorkspaces,
  normalBorderColor  = nBorder,
  focusedBorderColor = fBorder,
--  mouseBindings      = myMouseBindings,

  -- hooks, layouts
  layoutHook         = myLayoutHook,
  --manageHook         = myManageHook,
  --handleEventHook    = myEventHook,
  --logHook            = myLogHook,
  startupHook        = myStartupHook
} `additionalKeys` myKeys