|
|
@ -1,409 +0,0 @@
|
|
1
|
|
local awful = require("awful")
|
|
2
|
|
awful.autofocus = require("awful.autofocus")
|
|
3
|
|
awful.rules = require("awful.rules")
|
|
4
|
|
local wibox = require("wibox")
|
|
5
|
|
local vicious = require("vicious")
|
|
6
|
|
local beautiful = require("beautiful")
|
|
7
|
|
local naughty = require("naughty")
|
|
8
|
|
|
|
9
|
|
if awesome.startup_errors then
|
|
10
|
|
naughty.notify({ preset = naughty.config.presets.critical,
|
|
11
|
|
title = "Oops, there were errors during startup!",
|
|
12
|
|
text = awesome.startup_errors })
|
|
13
|
|
end
|
|
14
|
|
|
|
15
|
|
do
|
|
16
|
|
local in_error = false
|
|
17
|
|
awesome.connect_signal("debug::error", function (err)
|
|
18
|
|
-- Make sure we don't go into an endless error loop
|
|
19
|
|
if in_error then return end
|
|
20
|
|
in_error = true
|
|
21
|
|
|
|
22
|
|
naughty.notify({ preset = naughty.config.presets.critical,
|
|
23
|
|
title = "Oops, an error happened!",
|
|
24
|
|
text = err })
|
|
25
|
|
in_error = false
|
|
26
|
|
end)
|
|
27
|
|
end
|
|
28
|
|
|
|
29
|
|
beautiful.init("/usr/share/awesome/themes/zenburn/theme.lua")
|
|
30
|
|
|
|
31
|
|
terminal = "urxvt"
|
|
32
|
|
editor = os.getenv("EDITOR") or "vim"
|
|
33
|
|
editor_cmd = terminal .. " -e " .. editor
|
|
34
|
|
|
|
35
|
|
modkey = "Mod4"
|
|
36
|
|
|
|
37
|
|
layouts =
|
|
38
|
|
{
|
|
39
|
|
awful.layout.suit.spiral,
|
|
40
|
|
awful.layout.suit.tile,
|
|
41
|
|
awful.layout.suit.fair,
|
|
42
|
|
awful.layout.suit.max,
|
|
43
|
|
awful.layout.suit.floating
|
|
44
|
|
}
|
|
45
|
|
|
|
46
|
|
tags = {}
|
|
47
|
|
for s = 1, screen.count() do
|
|
48
|
|
-- Each screen has its own tag table.
|
|
49
|
|
tags[s] = awful.tag({ "term", "web", "irssi", 4, 5, 6, 7 }, s, layouts[1])
|
|
50
|
|
end
|
|
51
|
|
|
|
52
|
|
space = wibox.widget.textbox()
|
|
53
|
|
space:set_text(" ")
|
|
54
|
|
|
|
55
|
|
batterywidget = wibox.widget.textbox()
|
|
56
|
|
vicious.register(batterywidget, vicious.widgets.bat, "Bat: $2%", 61, "BAT0")
|
|
57
|
|
|
|
58
|
|
memorywidget = wibox.widget.textbox()
|
|
59
|
|
vicious.register(memorywidget, vicious.widgets.mem, "Mem: $1%", 2)
|
|
60
|
|
|
|
61
|
|
mailwidget = wibox.widget.textbox()
|
|
62
|
|
mdirs = {
|
|
63
|
|
"/home/lu/.mails/lu/INBOX",
|
|
64
|
|
"/home/lu/.mails/htwk.imn/INBOX",
|
|
65
|
|
"/home/lu/.mails/htwk/INBOX"
|
|
66
|
|
}
|
|
67
|
|
vicious.register(mailwidget, vicious.widgets.mdir, "New mails: $1", 59, mdirs)
|
|
68
|
|
|
|
69
|
|
mytextclock = awful.widget.textclock()
|
|
70
|
|
|
|
71
|
|
mywibox = {}
|
|
72
|
|
mypromptbox = {}
|
|
73
|
|
mylayoutbox = {}
|
|
74
|
|
mytaglist = {}
|
|
75
|
|
mytaglist.buttons = awful.util.table.join(
|
|
76
|
|
awful.button({ }, 1, awful.tag.viewonly),
|
|
77
|
|
awful.button({ modkey }, 1, awful.client.movetotag),
|
|
78
|
|
awful.button({ }, 3, awful.tag.viewtoggle),
|
|
79
|
|
awful.button({ modkey }, 3, awful.client.toggletag),
|
|
80
|
|
awful.button({ }, 4, awful.tag.viewnext),
|
|
81
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
|
82
|
|
)
|
|
83
|
|
mytasklist = {}
|
|
84
|
|
mytasklist.buttons = awful.util.table.join(
|
|
85
|
|
awful.button({ }, 1, function (c)
|
|
86
|
|
if c == client.focus then
|
|
87
|
|
c.minimized = true
|
|
88
|
|
else
|
|
89
|
|
if not c:isvisible() then
|
|
90
|
|
awful.tag.viewonly(c:tags()[1])
|
|
91
|
|
end
|
|
92
|
|
-- This will also un-minimize
|
|
93
|
|
-- the client, if needed
|
|
94
|
|
client.focus = c
|
|
95
|
|
c:raise()
|
|
96
|
|
end
|
|
97
|
|
end),
|
|
98
|
|
awful.button({ }, 3, function ()
|
|
99
|
|
if instance then
|
|
100
|
|
instance:hide()
|
|
101
|
|
instance = nil
|
|
102
|
|
else
|
|
103
|
|
instance = awful.menu.clients({ width=250 })
|
|
104
|
|
end
|
|
105
|
|
end),
|
|
106
|
|
awful.button({ }, 4, function ()
|
|
107
|
|
awful.client.focus.byidx(1)
|
|
108
|
|
if client.focus then client.focus:raise() end
|
|
109
|
|
end),
|
|
110
|
|
awful.button({ }, 5, function ()
|
|
111
|
|
awful.client.focus.byidx(-1)
|
|
112
|
|
if client.focus then client.focus:raise() end
|
|
113
|
|
end))
|
|
114
|
|
|
|
115
|
|
for s = 1, screen.count() do
|
|
116
|
|
-- Create a promptbox for each screen
|
|
117
|
|
mypromptbox[s] = awful.widget.prompt()
|
|
118
|
|
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
|
|
119
|
|
-- We need one layoutbox per screen.
|
|
120
|
|
mylayoutbox[s] = awful.widget.layoutbox(s)
|
|
121
|
|
mylayoutbox[s]:buttons(awful.util.table.join(
|
|
122
|
|
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
|
|
123
|
|
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
|
|
124
|
|
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
|
|
125
|
|
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
|
|
126
|
|
-- Create a taglist widget
|
|
127
|
|
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
|
128
|
|
|
|
129
|
|
-- Create a tasklist widget
|
|
130
|
|
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
|
131
|
|
|
|
132
|
|
-- Create the wibox
|
|
133
|
|
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
|
134
|
|
|
|
135
|
|
-- Widgets that are aligned to the left
|
|
136
|
|
local left_layout = wibox.layout.fixed.horizontal()
|
|
137
|
|
left_layout:add(mytaglist[s])
|
|
138
|
|
left_layout:add(mypromptbox[s])
|
|
139
|
|
|
|
140
|
|
-- Widgets that are aligned to the right
|
|
141
|
|
local right_layout = wibox.layout.fixed.horizontal()
|
|
142
|
|
if s == 1 then right_layout:add(wibox.widget.systray()) end
|
|
143
|
|
right_layout:add(mailwidget)
|
|
144
|
|
right_layout:add(space)
|
|
145
|
|
right_layout:add(memorywidget)
|
|
146
|
|
right_layout:add(space)
|
|
147
|
|
right_layout:add(batterywidget)
|
|
148
|
|
right_layout:add(space)
|
|
149
|
|
right_layout:add(mytextclock)
|
|
150
|
|
right_layout:add(mylayoutbox[s])
|
|
151
|
|
|
|
152
|
|
-- Now bring it all together (with the tasklist in the middle)
|
|
153
|
|
local layout = wibox.layout.align.horizontal()
|
|
154
|
|
layout:set_left(left_layout)
|
|
155
|
|
layout:set_middle(mytasklist[s])
|
|
156
|
|
layout:set_right(right_layout)
|
|
157
|
|
|
|
158
|
|
mywibox[s]:set_widget(layout)
|
|
159
|
|
end
|
|
160
|
|
|
|
161
|
|
root.buttons(awful.util.table.join(
|
|
162
|
|
awful.button({ }, 4, awful.tag.viewnext),
|
|
163
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
|
164
|
|
))
|
|
165
|
|
|
|
166
|
|
globalkeys = awful.util.table.join(
|
|
167
|
|
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
|
|
168
|
|
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
|
|
169
|
|
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
|
|
170
|
|
|
|
171
|
|
awful.key({ modkey, }, "j",
|
|
172
|
|
function ()
|
|
173
|
|
awful.client.focus.byidx( 1)
|
|
174
|
|
if client.focus then client.focus:raise() end
|
|
175
|
|
end),
|
|
176
|
|
awful.key({ modkey, }, "k",
|
|
177
|
|
function ()
|
|
178
|
|
awful.client.focus.byidx(-1)
|
|
179
|
|
if client.focus then client.focus:raise() end
|
|
180
|
|
end),
|
|
181
|
|
|
|
182
|
|
-- Layout manipulation
|
|
183
|
|
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
|
184
|
|
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
|
|
185
|
|
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
|
|
186
|
|
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
|
|
187
|
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
|
188
|
|
awful.key({ modkey, }, "Tab",
|
|
189
|
|
function ()
|
|
190
|
|
awful.client.focus.history.previous()
|
|
191
|
|
if client.focus then
|
|
192
|
|
client.focus:raise()
|
|
193
|
|
end
|
|
194
|
|
end),
|
|
195
|
|
|
|
196
|
|
-- Standard program
|
|
197
|
|
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
|
|
198
|
|
awful.key({ modkey, "Control" }, "r", awesome.restart),
|
|
199
|
|
awful.key({ modkey, "Shift" }, "q", awesome.quit),
|
|
200
|
|
|
|
201
|
|
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
|
|
202
|
|
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
|
|
203
|
|
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
|
|
204
|
|
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
|
|
205
|
|
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
|
|
206
|
|
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
|
|
207
|
|
|
|
208
|
|
awful.key({ modkey, "Control" }, "n", awful.client.restore),
|
|
209
|
|
|
|
210
|
|
-- Prompt
|
|
211
|
|
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
|
|
212
|
|
|
|
213
|
|
awful.key({ modkey }, "x",
|
|
214
|
|
function ()
|
|
215
|
|
awful.prompt.run({ prompt = "Run Lua code: " },
|
|
216
|
|
mypromptbox[mouse.screen].widget,
|
|
217
|
|
awful.util.eval, nil,
|
|
218
|
|
awful.util.getdir("cache") .. "/history_eval")
|
|
219
|
|
end),
|
|
220
|
|
|
|
221
|
|
awful.key({ modkey }, "l", function() os.execute(os.getenv('HOME') .. "/.bin/xkbswap") end),
|
|
222
|
|
awful.key({ modkey, "Shift" }, "l", function() os.execute("slock") end),
|
|
223
|
|
awful.key({ modkey }, "b", function() awful.util.spawn("chromium --allow-file-access-from-files", false) end),
|
|
224
|
|
awful.key({ modkey, "Shift" }, "b", function() awful.util.spawn("chromium --incognito --allow-file-access-from-files", false) end),
|
|
225
|
|
awful.key({ }, "Print", function ()
|
|
226
|
|
awful.util.spawn("scrot -e 'mv $f ~/m/pictures/ 2>/dev/null'")
|
|
227
|
|
end),
|
|
228
|
|
|
|
229
|
|
awful.key({ }, "XF86AudioMute", function() os.execute("amixer set Master toggle") end),
|
|
230
|
|
awful.key({ }, "XF86AudioLowerVolume", function() os.execute("amixer set Master 5%-") end),
|
|
231
|
|
awful.key({ }, "XF86AudioRaiseVolume", function() os.execute("amixer set Master 5%+") end),
|
|
232
|
|
|
|
233
|
|
awful.key({ modkey, "Shift" }, "m", function() os.execute("quodlibet") end)
|
|
234
|
|
)
|
|
235
|
|
|
|
236
|
|
clientkeys = awful.util.table.join(
|
|
237
|
|
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
|
|
238
|
|
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
|
|
239
|
|
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
|
|
240
|
|
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
|
|
241
|
|
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
|
|
242
|
|
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
|
|
243
|
|
awful.key({ modkey, }, "n",
|
|
244
|
|
function (c)
|
|
245
|
|
-- The client currently has the input focus, so it cannot be
|
|
246
|
|
-- minimized, since minimized clients can't have the focus.
|
|
247
|
|
c.minimized = true
|
|
248
|
|
end),
|
|
249
|
|
awful.key({ modkey, }, "m",
|
|
250
|
|
function (c)
|
|
251
|
|
c.maximized_horizontal = not c.maximized_horizontal
|
|
252
|
|
c.maximized_vertical = not c.maximized_vertical
|
|
253
|
|
end)
|
|
254
|
|
)
|
|
255
|
|
|
|
256
|
|
keynumber = 0
|
|
257
|
|
for s = 1, screen.count() do
|
|
258
|
|
keynumber = math.min(9, math.max(#tags[s], keynumber));
|
|
259
|
|
end
|
|
260
|
|
|
|
261
|
|
for i = 1, keynumber do
|
|
262
|
|
globalkeys = awful.util.table.join(globalkeys,
|
|
263
|
|
awful.key({ modkey }, "#" .. i + 9,
|
|
264
|
|
function ()
|
|
265
|
|
local screen = mouse.screen
|
|
266
|
|
if tags[screen][i] then
|
|
267
|
|
awful.tag.viewonly(tags[screen][i])
|
|
268
|
|
end
|
|
269
|
|
end),
|
|
270
|
|
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
|
271
|
|
function ()
|
|
272
|
|
local screen = mouse.screen
|
|
273
|
|
if tags[screen][i] then
|
|
274
|
|
awful.tag.viewtoggle(tags[screen][i])
|
|
275
|
|
end
|
|
276
|
|
end),
|
|
277
|
|
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
|
278
|
|
function ()
|
|
279
|
|
if client.focus and tags[client.focus.screen][i] then
|
|
280
|
|
awful.client.movetotag(tags[client.focus.screen][i])
|
|
281
|
|
end
|
|
282
|
|
end),
|
|
283
|
|
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
|
284
|
|
function ()
|
|
285
|
|
if client.focus and tags[client.focus.screen][i] then
|
|
286
|
|
awful.client.toggletag(tags[client.focus.screen][i])
|
|
287
|
|
end
|
|
288
|
|
end))
|
|
289
|
|
end
|
|
290
|
|
|
|
291
|
|
clientbuttons = awful.util.table.join(
|
|
292
|
|
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
|
293
|
|
awful.button({ modkey }, 1, awful.mouse.client.move),
|
|
294
|
|
awful.button({ modkey }, 3, awful.mouse.client.resize))
|
|
295
|
|
|
|
296
|
|
root.keys(globalkeys)
|
|
297
|
|
|
|
298
|
|
awful.rules.rules = {
|
|
299
|
|
-- All clients will match this rule.
|
|
300
|
|
{ rule = { },
|
|
301
|
|
properties = { border_width = 3,--beautiful.border_width,
|
|
302
|
|
border_color = beautiful.border_normal,
|
|
303
|
|
focus = true,
|
|
304
|
|
keys = clientkeys,
|
|
305
|
|
buttons = clientbuttons } },
|
|
306
|
|
{ rule = { class = "MPlayer" },
|
|
307
|
|
properties = { floating = true } },
|
|
308
|
|
{ rule = { class = "pinentry" },
|
|
309
|
|
properties = { floating = true } },
|
|
310
|
|
{ rule = { class = "gimp" },
|
|
311
|
|
properties = { floating = true } },
|
|
312
|
|
|
|
313
|
|
-- my own rules
|
|
314
|
|
{ rule = { class = "Chromium" },
|
|
315
|
|
properties = { tag = tags[1][2] } },
|
|
316
|
|
{ rule = { class = "Pidgin" },
|
|
317
|
|
properties = { tag = tags[1][3] } },
|
|
318
|
|
{ rule = { class = "Empathy" },
|
|
319
|
|
properties = { tag = tags[1][3] } }
|
|
320
|
|
}
|
|
321
|
|
|
|
322
|
|
client.connect_signal("manage", function (c, startup)
|
|
323
|
|
-- Enable sloppy focus
|
|
324
|
|
c:connect_signal("mouse::enter", function(c)
|
|
325
|
|
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
|
326
|
|
and awful.client.focus.filter(c) then
|
|
327
|
|
client.focus = c
|
|
328
|
|
end
|
|
329
|
|
end)
|
|
330
|
|
|
|
331
|
|
c.size_hints_honor = false
|
|
332
|
|
|
|
333
|
|
if not startup then
|
|
334
|
|
-- Set the windows at the slave,
|
|
335
|
|
-- i.e. put it at the end of others instead of setting it master.
|
|
336
|
|
-- awful.client.setslave(c)
|
|
337
|
|
|
|
338
|
|
-- Put windows in a smart way, only if they does not set an initial position.
|
|
339
|
|
if not c.size_hints.user_position and not c.size_hints.program_position then
|
|
340
|
|
awful.placement.no_overlap(c)
|
|
341
|
|
awful.placement.no_offscreen(c)
|
|
342
|
|
end
|
|
343
|
|
end
|
|
344
|
|
end)
|
|
345
|
|
|
|
346
|
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
|
347
|
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
|
348
|
|
|
|
349
|
|
|
|
350
|
|
screen[1]:connect_signal("tag::history::update", function()
|
|
351
|
|
os.execute("/home/lu/.bin/events tag '" .. awful.tag.selected(1).name .. "'")
|
|
352
|
|
end)
|
|
353
|
|
|
|
354
|
|
client.connect_signal("focus", function(c)
|
|
355
|
|
if (c.name == nil) then
|
|
356
|
|
return
|
|
357
|
|
end
|
|
358
|
|
os.execute("/home/lu/.bin/events focus '" .. c.name .. "'")
|
|
359
|
|
end)
|
|
360
|
|
|
|
361
|
|
client.connect_signal("property::name", function(c)
|
|
362
|
|
if (c.name == nil) then
|
|
363
|
|
return
|
|
364
|
|
end
|
|
365
|
|
os.execute("/home/lu/.bin/events focus '" .. c.name .. "'")
|
|
366
|
|
end)
|