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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
import XMonad
import XMonad.Hooks.SetWMName
import XMonad.Layout.Grid
import XMonad.Layout.ResizableTile
import XMonad.Layout.IM
import XMonad.Layout.ThreeColumns
import XMonad.Layout.NoBorders
import XMonad.Layout.Circle
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Fullscreen
import XMonad.Util.EZConfig
import XMonad.Util.Run
import XMonad.Util.Dzen
import XMonad.Util.NamedWindows
import XMonad.Hooks.DynamicLog
import XMonad.Actions.Plane
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ICCCMFocus
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.Ratio ((%))
import XMonad.Hooks.EwmhDesktops
-- import XMonad.Actions.Volume
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
-- import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig ( additionalKeys )
import XMonad.Config.Desktop
import System.IO
import System.Process
import qualified XMonad.StackSet as W
-- VARS
myModMask = mod4Mask -- changes the mod key to "super"
myFocusedBorderColor = "#ff0000" -- color of focused border
myNormalBorderColor = "#cccccc" -- color of inactive border
myBorderWidth = 1 -- width of border around windows
-- myTerminal = "terminator" -- which terminal software to use
myIMRosterTitle = "Buddy List" -- title of roster on IM workspace
-- use "Buddy List" for Pidgin, but
-- "Contact List" for Empathy
{-
Xmobar configuration variables. These settings control the appearance
of text which xmonad is sending to xmobar via the DynamicLog hook.
-}
myTitleColor = "#eeeeee" -- color of window title
myTitleLength = 80 -- truncate window title to this length
myCurrentWSColor = "#e6744c" -- color of active workspace
myVisibleWSColor = "#c185a7" -- color of inactive workspace
myUrgentWSColor = "#cc0000" -- color of workspace with 'urgent' window
myCurrentWSLeft = "[" -- wrap active workspace with these
myCurrentWSRight = "]"
myVisibleWSLeft = "(" -- wrap inactive workspace with these
myVisibleWSRight = ")"
myUrgentWSLeft = "{" -- wrap urgent workspace with these
myUrgentWSRight = "}"
myWorkspaces =
[
"7:Comm", "8:Web", "9:Vim",
"4:Docs", "5:Root", "6:Andr",
"1:Tex", "2:Vid", "3:Pix"
]
startupWorkspace = "5:Root" -- which workspace do you want to be on after launch?
defaultLayouts = smartBorders(avoidStruts(
-- ResizableTall layout has a large master window on the left,
-- and remaining windows tile on the right. By default each area
-- takes up half the screen, but you can resize using "super-h" and
-- "super-l".
ResizableTall 1 (3/100) (1/2) []
-- Mirrored variation of ResizableTall. In this layout, the large
-- master window is at the top, and remaining windows tile at the
-- bottom of the screen. Can be resized as described above.
||| Mirror (ResizableTall 1 (3/100) (1/2) [])
-- Full layout makes every window full screen. When you toggle the
-- active window, it will bring the active window to the front.
||| noBorders Full
-- ThreeColMid layout puts the large master window in the center
-- of the screen. As configured below, by default it takes of 3/4 of
-- the available space. Remaining windows tile to both the left and
-- right of the master window. You can resize using "super-h" and
-- "super-l".
||| ThreeColMid 1 (3/100) (3/4)
-- Circle layout places the master window in the center of the screen.
-- Remaining windows appear in a circle around it
||| Circle
-- Grid layout tries to equally distribute windows in the available
-- space, increasing the number of columns and rows as necessary.
-- Master window is at top left.
||| Grid))
chatLayout = avoidStruts(withIM (1%7) (Title myIMRosterTitle) Grid)
--gimpLayout = avoidStruts(ThreeColMid gimpMainWindow (3/100) (3/4))
gimpLayout = smartBorders(avoidStruts(ThreeColMid 1 (3/100) (3/4)))
--gimpLayout = withIM (1/6) gimpMainWindow Grid
--gimpLayout = withIM (1/6) gimpMainWindow Grid
gimpMainWindow = (And (Resource "gimpi-2.8")
(Not (Or (Title "Layers - Brushes")
(Role "gimp-image-window"))))
myLayouts =
onWorkspace "7:Comm" chatLayout
$ onWorkspace "3:Pix" gimpLayout
$ defaultLayouts
myKeyBindings =
[
((myModMask, xK_b), sendMessage ToggleStruts)
, ((myModMask, xK_a), sendMessage MirrorShrink)
, ((myModMask, xK_z), sendMessage MirrorExpand)
-- , ((myModMask, xK_x), spawn "screenshot")
, ((0, xK_Print), spawn "~/scripts/screenshot")
, ((myModMask .|. controlMask, xK_Print), spawn "~/scripts/windowshot")
, ((myModMask, xK_Print), spawn "~/scripts/fullestscreen")
-- , ((myModMask, xK_p), spawn "synapse")
-- , ((myModMask .|. mod1Mask, xK_space), spawn "synapse")
, ((myModMask, xK_u), focusUrgent)
-- , ((0, 0x1008FF12), spawn "amixer -q set Master toggle")
-- , ((0, 0x1008FF11), spawn "amixer -q set Master 4%-")
-- , ((0, 0x1008FF13), spawn "amixer -q set Master 4%+")
-- , ((0, xK_F8), spawn "set-volume M")
-- , ((myModMask, xK_F9), spawn "set-volume -")
-- , ((0, XF86AudioRaiseVolume), spawn -volume +")
, ((0, 0x1008FF12), spawn "~/scripts/set-volume M")
, ((0, 0x1008FF11), spawn "~/scripts/set-volume -")
, ((0, 0x1008FF13), spawn "~/scripts/set-volume +")
]
myManagementHooks :: [ManageHook]
myManagementHooks = [
resource =? "stalonetray" --> doIgnore
, (className =? "Thunderbird") --> doF (W.shift "7:Comm")
, (className =? "Pidgin") --> doF (W.shift "7:Comm")
, (className =? "Gimp") --> doF (W.shift "3:Pix")
, (className =? "Gimp-2.8") --> doF (W.shift "3:Pix")
, (className =? "Nautilus") --> doF (W.shift "4:Docs")
]
numPadKeys =
[
xK_KP_Home, xK_KP_Up, xK_KP_Page_Up,
xK_KP_Left, xK_KP_Begin, xK_KP_Right,
xK_KP_End, xK_KP_Down, xK_KP_Page_Down
]
numKeys =
[
xK_7, xK_8, xK_9,
xK_4, xK_5, xK_6,
xK_1, xK_2, xK_3
]
myKeys = myKeyBindings ++
[
((m .|. myModMask, k), windows $ f i)
| (i, k) <- zip myWorkspaces numPadKeys
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
] ++
[
((m .|. myModMask, k), windows $ f i)
| (i, k) <- zip myWorkspaces numKeys
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
] ++
M.toList (planeKeys myModMask (Lines 3) Finite) ++
[
((m .|. myModMask, key), screenWorkspace sc
>>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [1,0,2]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
]
--main = do
-- xmproc <- spawnPipe "xmobar"
-- xmonad $ defaultConfig
-- { manageHook = manageDocks <+> manageHook defaultConfig
-- , layoutHook = avoidStruts $ layoutHook defaultConfig
-- , logHook = dynamicLogWithPP xmobarPP
-- { ppOutput = hPutStrLn xmproc
-- , ppTitle = xmobarColor "green" "" . shorten 50
-- }
-- , modMask = mod4Mask -- Rebind Mod to the Windows key
-- } `additionalKeys`
-- [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock; xset dpms force off")
-- , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
-- , ((0, xK_Print), spawn "scrot")
-- ]
-- Alertwindow
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)
instance UrgencyHook LibNotifyUrgencyHook where
urgencyHook LibNotifyUrgencyHook w = do
name <- getName w
Just idx <- fmap (W.findTag w) $ gets windowset
safeSpawn "notify-send" [show name, "workspace " ++ idx]
-- spawn "notify-send" [show name, "workspace " ++ idx]
-- Functs
alert = dzenConfig centered . show . round
centered =
onCurr (center 150 66)
>=> font "-*-helvetica-*-r-*-*-64-*-*-*-*-*-*-*"
>=> addArgs ["-fg", "#80c0ff"]
>=> addArgs ["-bg", "#000040"]
-- Main
main :: IO ()
main = do
xmproc <- spawnPipe "xmobar ~/.xmonad/xmobarrc"
xmonad $ withUrgencyHook LibNotifyUrgencyHook $ ewmh $ defaultConfig {
-- xmonad $ withUrgencyHook LibNotifyUrgencyHook $ ewmh $ desktopConfig {
focusedBorderColor = myFocusedBorderColor
, normalBorderColor = myNormalBorderColor
-- , terminal = myTerminal
, borderWidth = myBorderWidth
, layoutHook = myLayouts
, workspaces = myWorkspaces
, modMask = myModMask
, handleEventHook = XMonad.Layout.Fullscreen.fullscreenEventHook
-- , handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook
, startupHook = do
setWMName "LG3D"
windows $ W.greedyView startupWorkspace
spawn "~/.xmonad/startup-hook"
, manageHook = manageHook defaultConfig
<+> composeAll myManagementHooks
<+> manageDocks
, logHook = takeTopFocus <+> dynamicLogWithPP xmobarPP {
ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor myTitleColor ""
. shorten myTitleLength
, ppCurrent = xmobarColor myCurrentWSColor ""
. wrap myCurrentWSLeft myCurrentWSRight
, ppVisible = xmobarColor myVisibleWSColor ""
. wrap myVisibleWSLeft myVisibleWSRight
, ppUrgent = xmobarColor myUrgentWSColor ""
. wrap myUrgentWSLeft myUrgentWSRight
}
} `additionalKeys` myKeys
|