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
| import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.Spacing(spacing)
import XMonad.Actions.WindowBringer
import XMonad.Actions.SpawnOn(spawnOn, spawnHere, manageSpawn)
import System.IO
import qualified Data.Map as M
import qualified XMonad.StackSet as W
modm = mod4Mask -- Win key for xmonad modificator
alt = mod1Mask
ctrl = controlMask
myWorkspaces = [ "1:desk"
, "2:chat"
, "3:net"
, "4:math"
, "5:doc"
, "6:extra"
, "7:misc"
, "8:music"
, "9:sys"
]
myManageHook :: ManageHook
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, className =? "Gimp" --> doFloat
, className =? "Pidgin" --> doShift "2:chat"
, className =? "Skype" --> doShift "2:chat"
, className =? "Opera" --> doShift "3:net"
, className =? "Vivaldi" --> doShift "3:net"
, isFullscreen --> doFullFloat
]
myStartupHook = do
spawnOn "9:sys" "mate-terminal"
spawnOn "9:sys" "pavucontrol"
spawnOn "9:sys" "mate-system-monitor"
myLayout = tiled ||| Mirror tiled ||| Full
where
-- default tiling algorithm partitions the screen into two panes
tiled = spacing 5 $ Tall nmaster delta ratio
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/4
-- Percent of screen to increment by when resizing panes
delta = 3/100
myMouseBindings _ = M.fromList $
-- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
-- mod-button2, Raise the window to the top of the stack
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-- mod-button3, Set the window to floating mode and resize by dragging
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))
-- you may also bind events to the mouse scroll wheel (button4 and button5)
]
navigationKeys =
-- Rotate through the available layout algorithms
[ ((modm, xK_space ), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
--, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook myConfig)
-- Resize viewed windows to the correct size
, ((modm, xK_n ), refresh)
-- Move focus to the next window
, ((modm, xK_Tab ), windows W.focusDown)
-- Move focus to the next window
, ((alt, xK_Tab ), windows W.focusDown)
-- Move focus to the previous window
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
-- Move focus to the previous window
, ((alt .|. shiftMask, xK_Tab ), windows W.focusUp)
-- Move focus to the master window
, ((modm, xK_m ), windows W.focusMaster)
-- Swap the focused window and the master window
, ((modm, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_j ), windows W.swapDown)
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_k ), windows W.swapUp)
-- quick menus for switching windows
, ((modm, xK_g ), gotoMenu)
, ((modm, xK_b ), bringMenu)
]
progKeys =
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal myConfig)
, ((alt .|. ctrl, xK_t), spawn $ XMonad.terminal myConfig)
, ((modm, xK_d), spawnHere "caja /disk")
, ((modm, xK_s), spawnHere "caja /storage")
, ((modm, xK_v), spawnHere "vivaldi")
, ((0, xK_Print), spawn "mate-screenshot")
-- , ((ctrl, xK_Print), spawn "mate-screenshot --window --save $HOME/Изображения")
-- launch dmenu
-- , ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
-- launch gmrun
, ((modm .|. shiftMask, xK_p), spawn "gmrun")
, ((modm, xK_F2), spawn "gmrun")
, ((modm, xK_F4), kill)
-- Restart xmonad
, ((modm, xK_q), spawn "xmonad --recompile && xmonad --restart")
]
--
-- mod-[1..9], Switch to workspace N
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
workspaceSwitchKeys =
[
((m .|. modm, k), windows $ f i)
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
--
screenSwitchKeys =
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
myKeyBindings = M.fromList $ concat
[ navigationKeys
, progKeys
, workspaceSwitchKeys
, screenSwitchKeys
]
myConfig = def
{ terminal = "mate-terminal"
, borderWidth = 2
, modMask = modm
, normalBorderColor = "#dddddd"
, focusedBorderColor = "#ff6600"
, workspaces = myWorkspaces
, keys = const myKeyBindings
, mouseBindings = myMouseBindings
, manageHook = manageSpawn <+> myManageHook <+> manageHook def
, startupHook = myStartupHook
, handleEventHook = fullscreenEventHook -- handle fullscreen games
, focusFollowsMouse = False
}
main = xmonad $ ewmh $ myConfig |