7
|
1 |
require("debug")
|
|
2 |
--
|
|
3 |
-- Standard awesome library
|
|
4 |
require("awful")
|
|
5 |
require("awful.autofocus")
|
|
6 |
-- Theme handling library
|
|
7 |
require("beautiful")
|
|
8 |
-- Notification library
|
|
9 |
require("naughty")
|
|
10 |
-- shifty - dynamic tagging library
|
|
11 |
require("shifty")
|
|
12 |
-- Revelation
|
|
13 |
require("revelation")
|
|
14 |
-- vicious widgets
|
|
15 |
local vicious = require("vicious")
|
|
16 |
local wicked = require("wicked")
|
|
17 |
-- Load Debian menu entries
|
|
18 |
require("debian.menu")
|
|
19 |
|
|
20 |
-- require("keychains")
|
|
21 |
|
|
22 |
require("my")
|
|
23 |
|
|
24 |
-- {{{ Error handling
|
|
25 |
-- Check if awesome encountered an error during startup and fell back to
|
|
26 |
-- another config (This code will only ever execute for the fallback config)
|
|
27 |
if awesome.startup_errors then
|
|
28 |
naughty.notify({ preset = naughty.config.presets.critical,
|
|
29 |
title = "Oops, there were errors during startup!",
|
|
30 |
text = awesome.startup_errors })
|
|
31 |
end
|
|
32 |
|
|
33 |
-- Handle runtime errors after startup
|
|
34 |
do
|
|
35 |
awesome.add_signal("debug::error", my.notify_error)
|
|
36 |
end
|
|
37 |
-- }}}
|
|
38 |
|
|
39 |
-- Variable definitions
|
|
40 |
-- Themes define colours, icons, and wallpapers
|
|
41 |
-- The default is a dark theme
|
|
42 |
-- theme_path = "/usr/share/awesome/themes/default/theme.lua"
|
|
43 |
-- Uncommment this for a lighter theme
|
|
44 |
theme_path = "/usr/share/awesome/themes/sky/theme.lua"
|
|
45 |
|
|
46 |
-- This is used later as the default terminal and editor to run.
|
|
47 |
terminal = "x-terminal-emulator"
|
8
|
48 |
-- terminal = "terminology"
|
7
|
49 |
editor = os.getenv("EDITOR") or "editor"
|
|
50 |
editor_cmd = terminal .. " -e " .. editor
|
|
51 |
browser = "iceweasel"
|
|
52 |
mail = "icedove"
|
|
53 |
musicplayer = "ario"
|
|
54 |
monitor = "gnome-system-monitor"
|
|
55 |
filemanager = "pcmanfm"
|
|
56 |
lookup = "pcmanfm -f"
|
|
57 |
calculator = "galculator"
|
8
|
58 |
-- Logout method
|
|
59 |
-- logout = awesome.quit
|
|
60 |
logout = my.mkspawn("obsession-logout")
|
7
|
61 |
|
|
62 |
-- Default modkey.
|
|
63 |
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
|
64 |
-- If you do not like this or do not have such a key, I suggest you to remap
|
|
65 |
-- Mod4 to another key using xmodmap or other tools. However, you can use
|
|
66 |
-- another modifier like Mod1, but it may interact with others.
|
|
67 |
modkey = "Mod4"
|
|
68 |
|
|
69 |
wallpaper_dir = "/home/fabien/themes/backgrounds/"
|
|
70 |
wallpaper = wallpaper_dir .. "universalis_1024_jsh.jpg"
|
|
71 |
|
|
72 |
-- Actually load theme
|
|
73 |
beautiful.init(theme_path)
|
|
74 |
beautiful.get().wallpaper_cmd = { "awsetbg -a " .. wallpaper }
|
|
75 |
awful.util.spawn_with_shell("pgrep unagi || unagi &")
|
|
76 |
|
|
77 |
|
|
78 |
-- Table of layouts to cover with awful.layout.inc, order matters.
|
|
79 |
layouts =
|
|
80 |
{
|
|
81 |
awful.layout.suit.tile,
|
|
82 |
awful.layout.suit.tile.left,
|
|
83 |
awful.layout.suit.tile.bottom,
|
|
84 |
awful.layout.suit.tile.top,
|
|
85 |
awful.layout.suit.fair,
|
|
86 |
awful.layout.suit.fair.horizontal,
|
|
87 |
awful.layout.suit.max,
|
|
88 |
awful.layout.suit.max.fullscreen,
|
|
89 |
awful.layout.suit.magnifier,
|
|
90 |
awful.layout.suit.floating
|
|
91 |
}
|
|
92 |
|
|
93 |
-- Define if we want to use titlebar on all applications.
|
|
94 |
use_titlebar = true
|
|
95 |
|
8
|
96 |
-- Remove the focus follow mouse install by shifty.
|
|
97 |
shifty.config.sloppy = false
|
|
98 |
|
7
|
99 |
-- Shifty configured tags.
|
|
100 |
shifty.config.tags = {
|
|
101 |
w1 = {
|
|
102 |
layout = awful.layout.suit.tile,
|
|
103 |
mwfact = 0.60,
|
|
104 |
exclusive = false,
|
|
105 |
position = 1,
|
|
106 |
init = true,
|
|
107 |
screen = 1,
|
|
108 |
slave = true,
|
|
109 |
},
|
|
110 |
web = {
|
|
111 |
layout = awful.layout.suit.tile.bottom,
|
|
112 |
mwfact = 0.65,
|
|
113 |
exclusive = true,
|
|
114 |
max_clients = 1,
|
8
|
115 |
position = 2,
|
7
|
116 |
spawn = browser,
|
|
117 |
},
|
|
118 |
mail = {
|
|
119 |
layout = awful.layout.suit.tile,
|
|
120 |
mwfact = 0.55,
|
|
121 |
exclusive = false,
|
8
|
122 |
position = 3,
|
7
|
123 |
spawn = mail,
|
|
124 |
slave = true
|
|
125 |
},
|
8
|
126 |
steam = {
|
|
127 |
layout = awful.layout.suit.float,
|
|
128 |
mwfact = 0.65,
|
|
129 |
exclusive = true,
|
|
130 |
spawn = "steam",
|
|
131 |
position = 4,
|
|
132 |
},
|
7
|
133 |
media = {
|
|
134 |
layout = awful.layout.suit.float,
|
|
135 |
exclusive = false,
|
8
|
136 |
position = 5,
|
7
|
137 |
spawn = musicplayer
|
|
138 |
},
|
|
139 |
office = {
|
|
140 |
layout = awful.layout.suit.tile,
|
8
|
141 |
position = 6,
|
7
|
142 |
},
|
|
143 |
}
|
|
144 |
|
|
145 |
-- SHIFTY: application matching rules
|
|
146 |
-- order here matters, early rules will be applied first
|
|
147 |
shifty.config.apps = {
|
|
148 |
{
|
|
149 |
match = {
|
|
150 |
"Navigator",
|
|
151 |
"Vimperator",
|
|
152 |
"Gran Paradiso",
|
|
153 |
},
|
|
154 |
float = false,
|
|
155 |
tag = "web",
|
|
156 |
},
|
|
157 |
{
|
|
158 |
match = {
|
|
159 |
"Shredder.*",
|
|
160 |
"Thunderbird",
|
|
161 |
"Icedove",
|
|
162 |
"mutt",
|
|
163 |
},
|
|
164 |
tag = "mail",
|
|
165 |
},
|
|
166 |
{
|
|
167 |
match = {
|
|
168 |
"pcmanfm",
|
|
169 |
},
|
|
170 |
slave = true
|
|
171 |
},
|
|
172 |
{
|
|
173 |
match = {
|
|
174 |
"OpenOffice.*",
|
|
175 |
"Abiword",
|
|
176 |
"Gnumeric",
|
|
177 |
},
|
|
178 |
tag = "office",
|
|
179 |
},
|
|
180 |
{
|
|
181 |
match = {
|
|
182 |
"Mplayer.*",
|
|
183 |
"Mirage",
|
|
184 |
"gimp",
|
|
185 |
"gtkpod",
|
|
186 |
"Ufraw",
|
|
187 |
"easytag",
|
|
188 |
"Ario",
|
|
189 |
},
|
|
190 |
tag = "media",
|
|
191 |
nopopup = true,
|
|
192 |
},
|
|
193 |
{
|
|
194 |
match = {
|
|
195 |
"MPlayer",
|
|
196 |
"Gnuplot",
|
|
197 |
"galculator",
|
|
198 |
"speedcrunch"
|
|
199 |
},
|
|
200 |
float = true,
|
|
201 |
},
|
|
202 |
{
|
|
203 |
match = { "emacs" },
|
|
204 |
tag = "emacs"
|
|
205 |
},
|
|
206 |
{
|
|
207 |
match = {
|
|
208 |
terminal,
|
|
209 |
},
|
|
210 |
honorsizehints = false,
|
|
211 |
slave = true,
|
|
212 |
},
|
|
213 |
{
|
|
214 |
match = { "Steam" },
|
|
215 |
tag = "steam",
|
|
216 |
},
|
|
217 |
{
|
8
|
218 |
match = { "kupfer.py" },
|
|
219 |
slave = true,
|
|
220 |
},
|
|
221 |
{
|
7
|
222 |
match = {""},
|
|
223 |
buttons = awful.util.table.join(
|
|
224 |
awful.button({}, 1, function (c) client.focus = c; c:raise() end),
|
|
225 |
awful.button({modkey}, 1, function(c)
|
|
226 |
client.focus = c
|
|
227 |
c:raise()
|
|
228 |
awful.mouse.client.move(c)
|
8
|
229 |
-- awful.mouse.client.dragtotag.border(c)
|
|
230 |
-- awful.mouse.client.dragtotag.widget(c)
|
7
|
231 |
end),
|
|
232 |
awful.button({modkey}, 3, awful.mouse.client.resize)
|
|
233 |
)
|
|
234 |
},
|
|
235 |
}
|
|
236 |
|
|
237 |
-- SHIFTY: default tag creation rules
|
|
238 |
-- parameter description
|
|
239 |
-- * floatBars : if floating clients should always have a titlebar
|
|
240 |
-- * guess_name : should shifty try and guess tag names when creating
|
|
241 |
-- new (unconfigured) tags?
|
|
242 |
-- * guess_position: as above, but for position parameter
|
|
243 |
-- * run : function to exec when shifty creates a new tag
|
|
244 |
-- * all other parameters (e.g. layout, mwfact) follow awesome's tag API
|
|
245 |
shifty.config.defaults = {
|
8
|
246 |
layout = awful.layout.suit.tile,
|
7
|
247 |
ncol = 1,
|
|
248 |
mwfact = 0.60,
|
|
249 |
floatBars = true,
|
|
250 |
guess_name = true,
|
|
251 |
guess_position = true,
|
|
252 |
}
|
|
253 |
|
|
254 |
-- Wibox
|
|
255 |
-- Create a textbox widget
|
|
256 |
mytextclock = awful.widget.textclock({align = "right"})
|
|
257 |
|
|
258 |
-- Create a laucher widget and a main menu
|
|
259 |
myawesomemenu = {
|
|
260 |
{"manual", terminal .. " -e man awesome"},
|
|
261 |
{"edit config",
|
|
262 |
editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua"},
|
|
263 |
{"restart", awesome.restart},
|
|
264 |
{"quit", my.quit}
|
|
265 |
}
|
|
266 |
|
|
267 |
mymainmenu = awful.menu(
|
|
268 |
{
|
|
269 |
items = {
|
|
270 |
{"awesome", myawesomemenu, beautiful.awesome_icon},
|
|
271 |
{ "Debian", debian.menu.Debian_menu.Debian },
|
|
272 |
{"open terminal", terminal}}
|
|
273 |
})
|
|
274 |
|
|
275 |
mylauncher = awful.widget.launcher({image = image(beautiful.awesome_icon),
|
|
276 |
menu = mymainmenu})
|
|
277 |
|
|
278 |
-- Create a systray
|
|
279 |
mysystray = widget({type = "systray", align = "right"})
|
|
280 |
|
|
281 |
-- Create a wibox for each screen and add it
|
|
282 |
mywibox = {}
|
|
283 |
mypromptbox = {}
|
|
284 |
mylayoutbox = {}
|
|
285 |
mytaglist = {}
|
|
286 |
mytaglist.buttons = awful.util.table.join(
|
|
287 |
awful.button({}, 1, awful.tag.viewonly),
|
|
288 |
awful.button({modkey}, 1, awful.client.movetotag),
|
|
289 |
awful.button({}, 3, function(tag) tag.selected = not tag.selected end),
|
|
290 |
awful.button({modkey}, 3, awful.client.toggletag),
|
|
291 |
awful.button({}, 4, awful.tag.viewnext),
|
|
292 |
awful.button({}, 5, awful.tag.viewprev)
|
|
293 |
)
|
|
294 |
|
|
295 |
mytasklist = {}
|
|
296 |
mytasklist.buttons = awful.util.table.join(
|
|
297 |
awful.button({}, 1, function(c)
|
|
298 |
if not c:isvisible() then
|
|
299 |
awful.tag.viewonly(c:tags()[1])
|
|
300 |
end
|
|
301 |
client.focus = c
|
|
302 |
c:raise()
|
|
303 |
end),
|
|
304 |
awful.button({modkey}, 3, my.show_clients),
|
|
305 |
awful.button({}, 3, function(c)
|
|
306 |
c.minimized = not c.minimized
|
|
307 |
end),
|
|
308 |
awful.button({}, 4, function()
|
|
309 |
awful.client.focus.byidx(1)
|
|
310 |
if client.focus then client.focus:raise() end
|
|
311 |
end),
|
|
312 |
awful.button({}, 5, function()
|
|
313 |
awful.client.focus.byidx(-1)
|
|
314 |
if client.focus then client.focus:raise() end
|
|
315 |
end))
|
|
316 |
|
|
317 |
local mycpuwidget = my.widgets.decorated(my.widgets.cpu(), my.mkspawn(monitor))
|
|
318 |
local mymemwidget = my.widgets.decorated(my.widgets.mem(), my.mkspawn(monitor))
|
|
319 |
local mynetwidget = my.widgets.decorated(my.widgets.net("eth1"), my.mkspawn(monitor))
|
|
320 |
-- local mynetupwidget = my.decorated_monitor_widget(make_netwidget("eth1", "up"))
|
|
321 |
-- local mynetdownwidget = my.decorated_monitor_widget(make_netwidget("eth1", "down"))
|
|
322 |
local myktwidget = my.widgets.mode()
|
|
323 |
|
|
324 |
for s = 1, screen.count() do
|
|
325 |
awful.util.spawn("awsetbg -a " .. wallpaper, false, s)
|
|
326 |
|
|
327 |
-- status box
|
|
328 |
|
|
329 |
-- Create a promptbox for each screen
|
|
330 |
mypromptbox[s] =
|
|
331 |
awful.widget.prompt({layout = awful.widget.layout.leftright})
|
|
332 |
-- Create an imagebox widget which will contains an icon indicating which
|
|
333 |
-- layout we're using. We need one layoutbox per screen.
|
|
334 |
mylayoutbox[s] = awful.widget.layoutbox(s)
|
|
335 |
mylayoutbox[s]:buttons(awful.util.table.join(
|
|
336 |
awful.button({}, 1, function() awful.layout.inc(layouts, 1) end),
|
|
337 |
awful.button({}, 3, function() awful.layout.inc(layouts, -1) end),
|
|
338 |
awful.button({}, 4, function() awful.layout.inc(layouts, 1) end),
|
|
339 |
awful.button({}, 5, function() awful.layout.inc(layouts, -1) end)))
|
|
340 |
-- Create a taglist widget
|
|
341 |
mytaglist[s] = awful.widget.taglist.new(s,
|
|
342 |
awful.widget.taglist.label.all,
|
|
343 |
mytaglist.buttons)
|
|
344 |
|
|
345 |
-- Create a tasklist widget
|
|
346 |
mytasklist[s] = awful.widget.tasklist.new(
|
|
347 |
function(c)
|
|
348 |
return awful.widget.tasklist.label.currenttags(c, s)
|
|
349 |
end,
|
|
350 |
mytasklist.buttons)
|
|
351 |
|
|
352 |
|
|
353 |
-- Create the wibox
|
|
354 |
mywibox[s] = awful.wibox({position = "top", screen = s})
|
|
355 |
-- Add widgets to the wibox - order matters
|
|
356 |
mywibox[s].widgets = {
|
|
357 |
{
|
|
358 |
myktwidget,
|
|
359 |
mylauncher,
|
|
360 |
s == 1 and mycpuwidget or nil,
|
|
361 |
s == 1 and mymemwidget or nil,
|
|
362 |
mytaglist[s],
|
|
363 |
mypromptbox[s],
|
|
364 |
layout = awful.widget.layout.horizontal.leftright
|
|
365 |
},
|
|
366 |
mylayoutbox[s],
|
|
367 |
s == 1 and mynetwidget or nil,
|
|
368 |
mytextclock,
|
|
369 |
s == 1 and mysystray or nil,
|
|
370 |
mytasklist[s],
|
|
371 |
layout = awful.widget.layout.horizontal.rightleft
|
|
372 |
}
|
|
373 |
|
|
374 |
mywibox[s].screen = s
|
|
375 |
end
|
|
376 |
|
|
377 |
-- SHIFTY: initialize shifty
|
|
378 |
-- the assignment of shifty.taglist must always be after its actually
|
|
379 |
-- initialized with awful.widget.taglist.new()
|
|
380 |
shifty.taglist = mytaglist
|
|
381 |
shifty.init()
|
|
382 |
|
|
383 |
-- Mouse bindings
|
|
384 |
root.buttons(awful.util.table.join(
|
|
385 |
awful.button({}, 3, function() mymainmenu:toggle() end),
|
|
386 |
awful.button({}, 4, awful.tag.viewnext),
|
|
387 |
awful.button({}, 5, awful.tag.viewprev)
|
|
388 |
))
|
|
389 |
|
|
390 |
-- key tables
|
|
391 |
|
|
392 |
local tagkeys = {
|
|
393 |
-- Shifty: keybindings specific to shifty
|
|
394 |
my.make_key("n", "Send to Next Tag", shifty.send_next), -- client to next tag
|
|
395 |
my.make_key("a", "Add tag", my.mkinteractive(shifty.add)), -- create a new tag
|
|
396 |
my.make_key("r", "Rename tag", my.mkinteractive(shifty.rename)), -- rename a tag
|
|
397 |
my.make_key("d", "Delete tag", shifty.del),
|
|
398 |
my.make_key("Shift+A", "Add tag (no popup)", -- nopopup new tag
|
|
399 |
my.mkinteractive(function() shifty.add({nopopup = true}) end)),
|
|
400 |
my.make_key("Up", "View prev",
|
|
401 |
function () awful.tag.viewprev(); return true; end),
|
|
402 |
my.make_key("Down", "View next",
|
|
403 |
function () awful.tag.viewnext(); return true; end),
|
8
|
404 |
my.make_key("Shift+Up", "Move tag right",
|
7
|
405 |
function()
|
|
406 |
local t = awful.tag.selected()
|
|
407 |
local s = awful.util.cycle(screen.count(), t.screen + 1)
|
|
408 |
awful.tag.history.restore()
|
|
409 |
t = shifty.tagtoscr(s, t)
|
|
410 |
awful.tag.viewonly(t)
|
|
411 |
return true
|
|
412 |
end),
|
8
|
413 |
my.make_key("Shift+Down", "Move tag left",
|
7
|
414 |
function()
|
|
415 |
local t = awful.tag.selected()
|
8
|
416 |
local s = awful.util.cycle(screen.count(), t.screen - 1)
|
7
|
417 |
awful.tag.history.restore()
|
|
418 |
t = shifty.tagtoscr(s, t)
|
|
419 |
awful.tag.viewonly(t)
|
|
420 |
return true
|
|
421 |
end),
|
|
422 |
}
|
|
423 |
|
|
424 |
local awesome_keys = {
|
|
425 |
my.make_key("m", "Menu", my.mkinteractive(function ()
|
|
426 |
mymainmenu:show({keygrabber=true})
|
|
427 |
return true
|
|
428 |
end)),
|
|
429 |
-- my.make_key("k", "Kill all clients",
|
|
430 |
-- function ()
|
|
431 |
-- for client.
|
|
432 |
-- my.kill_all(function (c)
|
|
433 |
my.make_key("r", "Restart", awesome.restart),
|
8
|
434 |
my.make_key("q", "Quit", logout),
|
7
|
435 |
my.make_key("t", "Terminal", my.mkspawn(terminal)),
|
8
|
436 |
my.make_key("f", "Toggle sloppy mouse", my.sloppy_toggle)
|
7
|
437 |
}
|
|
438 |
|
|
439 |
local layout_keys = {
|
|
440 |
my.make_key("Right", "Focus right",
|
|
441 |
function () awful.client.focus.bydirection("right"); return true end),
|
|
442 |
my.make_key("Left", "Focus left",
|
|
443 |
function () awful.client.focus.bydirection("left"); return true end),
|
|
444 |
my.make_key("Up", "Focus up",
|
|
445 |
function () awful.client.focus.bydirection("up"); return true end),
|
|
446 |
my.make_key("Down", "Focus down",
|
|
447 |
function () awful.client.focus.bydirection("down"); return true end),
|
|
448 |
my.make_key("Shift+Right", "Move right",
|
|
449 |
function () awful.client.swap.bydirection("right"); return true end),
|
|
450 |
my.make_key("Shift+Left", "Move left",
|
|
451 |
function () awful.client.swap.bydirection("left"); return true end),
|
|
452 |
my.make_key("Shift+Up", "Move up",
|
|
453 |
function () awful.client.swap.bydirection("up"); return true end),
|
|
454 |
my.make_key("Shift+Down", "Move down",
|
|
455 |
function () awful.client.swap.bydirection("down"); return true end),
|
|
456 |
-- my.make_key("Right", "Focus next",
|
|
457 |
-- function () awful.client.focus.byidx(1); return true end),
|
|
458 |
-- my.make_key("Left", "Focus prev",
|
|
459 |
-- function () awful.client.focus.byidx(-1); return true end),
|
|
460 |
-- my.make_key("Shift+Right", "Move next",
|
|
461 |
-- function() awful.client.swap.byidx(1); return true end),
|
|
462 |
-- my.make_key("Shift+Left", "Move previous",
|
|
463 |
-- function() awful.client.swap.byidx(-1); return true end),
|
|
464 |
-- my.make_key("Shift+Right", "Move next",
|
|
465 |
-- function() awful.screen.focus(1); return true end),
|
|
466 |
-- my.make_key("Shift+Left", "Move previous",
|
|
467 |
-- function() awful.screen.focus(-1); return true end),
|
|
468 |
my.make_key("c", "Master grow",
|
|
469 |
function() awful.tag.incmwfact(0.05); return true end),
|
|
470 |
my.make_key("z", "Master shrink",
|
|
471 |
function() awful.tag.incmwfact(-0.05); return true end),
|
|
472 |
my.make_key("Shift+c", "Add master windows",
|
|
473 |
function() awful.tag.incnmaster(1); return true end),
|
|
474 |
my.make_key("Shift+z", "Remove master windows",
|
|
475 |
function() awful.tag.incnmaster(-1); return true end),
|
|
476 |
my.make_key("Control+c", "Add column",
|
|
477 |
function() awful.tag.incncol(1); return true end),
|
|
478 |
my.make_key("Control+z", "Remove column",
|
|
479 |
function() awful.tag.incncol(-1); return true end),
|
|
480 |
my.make_key("Space", "Next layout",
|
|
481 |
function() awful.layout.inc(layouts, 1); return true end),
|
|
482 |
my.make_key("Shift+_", "Previous layout",
|
|
483 |
function() awful.layout.inc(layouts, -1) ; return true end),
|
|
484 |
}
|
|
485 |
|
|
486 |
media_keys = {
|
|
487 |
-- media keys
|
|
488 |
my.make_key("XF86HomePage", "Browser", my.mkspawn(browser)),
|
|
489 |
my.make_key("XF86Mail", "Mail", my.mkspawn(mail)),
|
|
490 |
my.make_key("XF86Search", "Search file...", my.mkspawn(lookup)),
|
|
491 |
my.make_key("XF86Explorer", "File Manager", my.mkspawn(filemanager)),
|
|
492 |
my.make_key("XF86Calculator", "Calculator", my.mkspawn(calculator)),
|
|
493 |
my.make_key("XF86Tools", "Music", my.mkspawn(musicplayer)),
|
|
494 |
my.make_key("XF86AudioPrev", "Previous song", my.mkspawn("mpc prev")),
|
|
495 |
my.make_key("XF86AudioNext", "Next song", my.mkspawn("mpc next")),
|
|
496 |
my.make_key("XF86AudioPlay", "Play song", my.mkspawn("mpc toggle")),
|
|
497 |
my.make_key("XF86AudioMute", "Mute", my.mkspawn("pulseaudio-ctl mute")),
|
|
498 |
my.make_key("XF86AudioLowerVolume", "Volume down", my.mkspawn("pulseaudio-ctl down")),
|
|
499 |
my.make_key("XF86AudioRaiseVolume", "Volume up", my.mkspawn("pulseaudio-ctl up")),
|
|
500 |
my.make_key("XF86Eject", "Eject", my.mkspawn("eject")),
|
|
501 |
}
|
|
502 |
|
|
503 |
global_table = {
|
|
504 |
my.make_key("Escape", "Restore History", awful.tag.history.restore),
|
|
505 |
my.make_key("e", "Revel windows", revelation),
|
|
506 |
my.make_key("c", "Previous tag", awful.tag.viewprev),
|
|
507 |
my.make_key("z", "Next tag", awful.tag.viewnext),
|
|
508 |
my.make_key("Right", "Right client", my.make_focus_bydirection("right")),
|
|
509 |
my.make_key("Left", "Left client", my.make_focus_bydirection("left")),
|
|
510 |
my.make_key("Up", "Up client", my.make_focus_bydirection("up")),
|
|
511 |
my.make_key("Down", "Down client", my.make_focus_bydirection("down")),
|
|
512 |
my.make_key("u", "Jump to urgent", awful.client.urgent.jumpto),
|
|
513 |
my.make_key("Tab", "Previous client",
|
|
514 |
function()
|
|
515 |
awful.client.focus.history.previous()
|
|
516 |
if client.focus then
|
|
517 |
client.focus:raise()
|
|
518 |
end
|
|
519 |
end),
|
|
520 |
|
|
521 |
-- Prompt
|
|
522 |
my.make_key("F2", "Run...", function()
|
|
523 |
awful.prompt.run({prompt = "Run: "},
|
|
524 |
mypromptbox[mouse.screen].widget,
|
|
525 |
awful.util.spawn, awful.completion.shell,
|
|
526 |
awful.util.getdir("cache") .. "/history")
|
|
527 |
end),
|
|
528 |
|
|
529 |
my.make_key("F3", "Eval...", function()
|
|
530 |
awful.prompt.run({prompt = "Run Lua code: "},
|
|
531 |
mypromptbox[mouse.screen].widget,
|
|
532 |
awful.util.eval, nil,
|
|
533 |
awful.util.getdir("cache") .. "/history_eval")
|
|
534 |
end),
|
|
535 |
|
|
536 |
-- modal key binding
|
|
537 |
my.make_key("a", "Main mode", my.make_kt(awesome_keys, "awesome") ),
|
|
538 |
my.make_key("t", "Tag mode...", my.make_kt(tagkeys, "tag") ),
|
|
539 |
my.make_key("l", "layout mode...", my.make_kt(layout_keys, "layout") ),
|
|
540 |
}
|
|
541 |
|
|
542 |
client_keytable = {
|
|
543 |
my.make_key("F4", "Kill client",
|
|
544 |
function(c) c:kill() end),
|
|
545 |
my.make_key("k", "Kill client",
|
|
546 |
function(c) c:kill() end),
|
|
547 |
my.make_key("f", "Toggle fullscreen",
|
|
548 |
function(c) c.fullscreen = not c.fullscreen end),
|
|
549 |
my.make_key("space", "Toggle floating",
|
|
550 |
awful.client.floating.toggle),
|
|
551 |
my.make_key("m", "Toggle maximize",
|
|
552 |
function(c)
|
|
553 |
c.maximized_horizontal = not c.maximized_horizontal
|
|
554 |
c.maximized_vertical = not c.maximized_vertical
|
|
555 |
end),
|
|
556 |
my.make_key("h", "Toggle minimized",
|
|
557 |
function (c)
|
|
558 |
c.minimized = not c.minimized
|
|
559 |
end),
|
|
560 |
my.make_key("Return", "Swap master",
|
|
561 |
function(c)
|
|
562 |
c:swap(awful.client.getmaster())
|
|
563 |
end),
|
|
564 |
my.make_key("o", "Move to screen", awful.client.movetoscreen),
|
|
565 |
}
|
|
566 |
|
|
567 |
-- Key bindings
|
|
568 |
globalkeys = awful.util.table.join(
|
|
569 |
awful.key({modkey}, "F1", function () my.show_kt(global_table, "Global binding") end),
|
|
570 |
my.make_globalkeys({modkey}, global_table),
|
|
571 |
my.make_globalkeys({}, media_keys),
|
|
572 |
-- forcing restart of mpd.
|
|
573 |
-- it sometime have difficulty to connect to pulse
|
|
574 |
awful.key({modkey}, "F6", function ()
|
|
575 |
awful.util.spawn("pkill -9 mpd")
|
|
576 |
awful.util.spawn("mpd")
|
|
577 |
end)
|
|
578 |
)
|
|
579 |
|
|
580 |
|
|
581 |
-- Client awful tagging: this is useful to tag some clients and then do stuff
|
|
582 |
-- like move to tag on them
|
|
583 |
clientkeys = awful.util.table.join(
|
|
584 |
awful.key({modkey, "Shift"}, "F1",
|
|
585 |
function () my.show_kt(client_keytable, "Client binding") end),
|
|
586 |
my.make_globalkeys({modkey}, client_keytable),
|
|
587 |
awful.key({modkey, "Shift"}, "r", function(c) c:redraw() end),
|
|
588 |
awful.key({modkey, "Shift"}, "t", awful.client.togglemarked))
|
|
589 |
|
|
590 |
|
|
591 |
-- SHIFTY: assign client keys to shifty for use in
|
|
592 |
-- match() function(manage hook)
|
|
593 |
shifty.config.clientkeys = clientkeys
|
|
594 |
shifty.config.modkey = modkey
|
|
595 |
|
|
596 |
-- Compute the maximum number of digit we need, limited to 10
|
|
597 |
local number_row = {
|
|
598 |
'"', '<', '>', '(', ')',
|
|
599 |
'@', '+', '-', '/', '*'
|
|
600 |
}
|
|
601 |
|
|
602 |
for i = 1, (shifty.config.maxtags or #number_row) do
|
|
603 |
local k = number_row[i-1]
|
|
604 |
globalkeys = awful.util.table.join(
|
|
605 |
globalkeys,
|
|
606 |
awful.key({modkey}, k, function()
|
8
|
607 |
local t = awful.tag.viewonly(shifty.getpos(i-1))
|
7
|
608 |
end),
|
|
609 |
awful.key({modkey, "Control"}, k, function()
|
8
|
610 |
local t = shifty.getpos(i-1)
|
7
|
611 |
t.selected = not t.selected
|
|
612 |
end),
|
|
613 |
awful.key({modkey, "Control", "Shift"}, k, function()
|
|
614 |
if client.focus then
|
8
|
615 |
awful.client.toggletag(shifty.getpos(i-1))
|
7
|
616 |
end
|
|
617 |
end),
|
|
618 |
-- move clients to other tags
|
|
619 |
awful.key({modkey, "Shift"}, k, function()
|
|
620 |
if client.focus then
|
8
|
621 |
t = shifty.getpos(i-1)
|
7
|
622 |
awful.client.movetotag(t)
|
|
623 |
awful.tag.viewonly(t)
|
|
624 |
end
|
|
625 |
end))
|
|
626 |
end
|
|
627 |
|
|
628 |
-- Set keys
|
|
629 |
-- mympdwidget:append_global_keys()
|
|
630 |
-- keychains.init(globalkeys,{})
|
|
631 |
root.keys(globalkeys)
|
|
632 |
|
|
633 |
-- local function kt2kc(kt)
|
|
634 |
-- t = {}
|
|
635 |
-- for _,k in ipairs(kt) do
|
|
636 |
-- t[k.key] = { func = k.func, info = key.desc }
|
|
637 |
-- end
|
|
638 |
-- return t
|
|
639 |
-- end
|
|
640 |
-- keychains.add({modkey}, "w", "Awesome", nil, kt2kc(awesome_keys))
|
|
641 |
-- keychains.start(5)
|
|
642 |
|
|
643 |
-- Hook function to execute when focusing a client.
|
|
644 |
client.add_signal("focus",
|
|
645 |
function(c)
|
8
|
646 |
-- my.notify_error("Client focus:\n" .. debug.traceback())
|
7
|
647 |
if not awful.client.ismarked(c) then
|
|
648 |
c.border_color = beautiful.border_focus
|
|
649 |
c.opacity = 1.0
|
|
650 |
end
|
|
651 |
end)
|
|
652 |
|
|
653 |
-- Hook function to execute when unfocusing a client.
|
|
654 |
client.add_signal("unfocus", function(c)
|
|
655 |
if not awful.client.ismarked(c) then
|
|
656 |
c.border_color = beautiful.border_normal
|
|
657 |
c.opacity = 0.8
|
|
658 |
end
|
|
659 |
end)
|
|
660 |
|
8
|
661 |
my.sloppy_install(0.5)
|