287 {"awesome", myawesomemenu, beautiful.awesome_icon}, |
133 {"awesome", myawesomemenu, beautiful.awesome_icon}, |
288 { "Debian", debian.menu.Debian_menu.Debian }, |
134 { "Debian", debian.menu.Debian_menu.Debian }, |
289 {"open terminal", terminal}} |
135 {"open terminal", terminal}} |
290 }) |
136 }) |
291 |
137 |
292 mylauncher = awful.widget.launcher({image = beautiful.awesome_icon, |
138 mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, |
293 menu = mymainmenu}) |
139 menu = mymainmenu }) |
|
140 |
|
141 -- Menubar configuration |
|
142 menubar.utils.terminal = terminal -- Set the terminal for applications that require it |
|
143 -- }}} |
|
144 |
|
145 -- {{{ Wibox |
|
146 -- Create a textclock widget |
|
147 mytextclock = awful.widget.textclock() |
294 |
148 |
295 -- Create a systray |
149 -- Create a systray |
296 mysystray = wibox.widget.systray({align = "right"}) |
150 mysystray = wibox.widget.systray({align = "right"}) |
297 |
151 |
298 -- Create a wibox for each screen and add it |
152 -- Create a wibox for each screen and add it |
299 mywibox = {} |
153 mywibox = {} |
300 mypromptbox = {} |
154 mypromptbox = {} |
301 mylayoutbox = {} |
155 mylayoutbox = {} |
302 mytaglist = {} |
156 mytaglist = {} |
303 mytaglist.buttons = awful.util.table.join( |
157 mytaglist.buttons = awful.util.table.join( |
304 awful.button({}, 1, awful.tag.viewonly), |
158 awful.button({ }, 1, awful.tag.viewonly), |
305 awful.button({modkey}, 1, awful.client.movetotag), |
159 awful.button({ modkey }, 1, awful.client.movetotag), |
306 awful.button({}, 3, function(tag) tag.selected = not tag.selected end), |
160 awful.button({ }, 3, awful.tag.viewtoggle), |
307 awful.button({modkey}, 3, awful.client.toggletag), |
161 awful.button({ modkey }, 3, awful.client.toggletag), |
308 awful.button({}, 4, awful.tag.viewnext), |
162 awful.button({ }, 4, function(t) |
309 awful.button({}, 5, awful.tag.viewprev) |
163 awful.tag.viewnext(awful.tag.getscreen(t)) end), |
|
164 awful.button({ }, 5, function(t) |
|
165 awful.tag.viewprev(awful.tag.getscreen(t)) end) |
310 ) |
166 ) |
311 |
|
312 mytasklist = {} |
167 mytasklist = {} |
313 mytasklist.buttons = awful.util.table.join( |
168 mytasklist.buttons = awful.util.table.join( |
314 awful.button({}, 1, function(c) |
169 awful.button({ }, 1, function (c) |
315 if not c:isvisible() then |
170 if c == client.focus then |
316 awful.tag.viewonly(c:tags()[1]) |
171 c.minimized = true |
|
172 else |
|
173 -- Without this, the following |
|
174 -- :isvisible() makes no sense |
|
175 c.minimized = false |
|
176 if not c:isvisible() then |
|
177 awful.tag.viewonly(c:tags()[1]) |
|
178 end |
|
179 -- This will also un-minimize |
|
180 -- the client, if needed |
|
181 client.focus = c |
|
182 c:raise() |
317 end |
183 end |
318 client.focus = c |
184 end), |
319 c:raise() |
185 awful.button({ }, 3, function () |
320 end), |
186 if instance then |
321 awful.button({modkey}, 3, my.show_clients), |
187 instance:hide() |
322 awful.button({}, 3, function(c) |
188 instance = nil |
323 c.minimized = not c.minimized |
189 else |
324 end), |
190 instance = awful.menu.clients({ |
325 awful.button({}, 4, function() |
191 theme = { width = 250 } |
|
192 }) |
|
193 end |
|
194 end), |
|
195 awful.button({ }, 4, function () |
326 awful.client.focus.byidx(1) |
196 awful.client.focus.byidx(1) |
327 if client.focus then client.focus:raise() end |
197 if client.focus then client.focus:raise() end |
328 end), |
198 end), |
329 awful.button({}, 5, function() |
199 awful.button({ }, 5, function () |
330 awful.client.focus.byidx(-1) |
200 awful.client.focus.byidx(-1) |
331 if client.focus then client.focus:raise() end |
201 if client.focus then client.focus:raise() end |
332 end)) |
202 end)) |
333 |
203 |
334 local mycpuwidget = my.widgets.decorated(my.widgets.cpu(), my.mkspawn(monitor)) |
204 local mycpuwidget = my.widgets.decorated(my.widgets.cpu(), my.mkspawn(monitor)) |
335 local mymemwidget = my.widgets.decorated(my.widgets.mem(), my.mkspawn(monitor)) |
205 local mymemwidget = my.widgets.decorated(my.widgets.mem(), my.mkspawn(monitor)) |
336 local mynetwidget = my.widgets.decorated(my.widgets.net("eth1"), my.mkspawn(monitor)) |
206 local mynetwidget = my.widgets.decorated(my.widgets.net("eth1"), my.mkspawn(monitor)) |
337 -- local mynetupwidget = my.decorated_monitor_widget(make_netwidget("eth1", "up")) |
207 -- local mynetupwidget = my.decorated_monitor_widget(make_netwidget("eth1", "up")) |
338 -- local mynetdownwidget = my.decorated_monitor_widget(make_netwidget("eth1", "down")) |
208 -- local mynetdownwidget = my.decorated_monitor_widget(make_netwidget("eth1", "down")) |
339 local myktwidget = my.widgets.mode() |
209 local mymodewidget = my.widgets.mode() |
|
210 |
340 |
211 |
341 for s = 1, screen.count() do |
212 for s = 1, screen.count() do |
342 awful.util.spawn(wallpaper_cmd, false, s) |
213 -- Create a promptbox for each screen |
343 |
214 mypromptbox[s] = awful.widget.prompt() |
344 -- status box |
215 -- Create an imagebox widget which will contains an icon indicating which layout we're using. |
345 |
216 -- We need one layoutbox per screen. |
346 -- Create a promptbox for each screen |
217 mylayoutbox[s] = awful.widget.layoutbox(s) |
347 mypromptbox[s] = awful.widget.prompt() |
218 mylayoutbox[s]:buttons(awful.util.table.join( |
348 -- Create an imagebox widget which will contains an icon indicating which |
219 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), |
349 -- layout we're using. We need one layoutbox per screen. |
220 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), |
350 mylayoutbox[s] = awful.widget.layoutbox(s) |
221 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), |
351 mylayoutbox[s]:buttons(awful.util.table.join( |
222 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) |
352 awful.button({}, 1, function() awful.layout.inc(layouts, 1) end), |
223 -- Create a taglist widget |
353 awful.button({}, 3, function() awful.layout.inc(layouts, -1) end), |
224 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) |
354 awful.button({}, 4, function() awful.layout.inc(layouts, 1) end), |
225 |
355 awful.button({}, 5, function() awful.layout.inc(layouts, -1) end))) |
226 -- Create a tasklist widget |
356 -- Create a taglist widget |
227 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) |
357 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) |
228 |
358 |
229 -- Create the wibox |
359 -- Create a tasklist widget |
230 mywibox[s] = awful.wibox({ position = "top", screen = s }) |
360 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) |
231 |
361 |
232 -- Widgets that are aligned to the left |
362 -- Create the wibox |
233 local left_layout = wibox.layout.fixed.horizontal() |
363 mywibox[s] = awful.wibox({position = "top", screen = s}) |
234 left_layout:add(mymodewidget) |
364 -- Add widgets to the wibox - order matters |
235 left_layout:add(mylauncher) |
365 local left_layout = wibox.layout.fixed.horizontal() |
236 if s == 1 then |
366 left_layout:add(myktwidget) |
237 left_layout:add(mycpuwidget) |
367 left_layout:add(mylauncher) |
238 left_layout:add(mymemwidget) |
368 if s == 1 then |
239 end |
369 left_layout:add(mycpuwidget) |
240 left_layout:add(mytaglist[s]) |
370 left_layout:add(mymemwidget) |
241 left_layout:add(mypromptbox[s]) |
371 end |
242 |
372 left_layout:add(mytaglist[s]) |
243 -- Widgets that are aligned to the right |
373 left_layout:add(mypromptbox[s]) |
244 local right_layout = wibox.layout.fixed.horizontal() |
374 |
245 if s == 1 then |
375 local right_layout = wibox.layout.fixed.horizontal() |
246 right_layout:add(mynetwidget) |
376 if (s == 1) then right_layout:add(mynetwidget) end |
247 right_layout:add(mysystray) |
377 if (s == 1) then right_layout:add(mysystray) end |
248 end |
378 right_layout:add(mytextclock) |
249 right_layout:add(mytextclock) |
379 right_layout:add(mylayoutbox[s]) |
250 right_layout:add(mylayoutbox[s]) |
380 |
251 |
381 local layout = wibox.layout.align.horizontal() |
252 -- Now bring it all together (with the tasklist in the middle) |
382 layout:set_left(left_layout) |
253 local layout = wibox.layout.align.horizontal() |
383 layout:set_middle(mytasklist[s]) |
254 layout:set_left(left_layout) |
384 layout:set_right(right_layout) |
255 layout:set_middle(mytasklist[s]) |
385 mywibox[s]:set_widget(layout) |
256 layout:set_right(right_layout) |
|
257 |
|
258 mywibox[s]:set_widget(layout) |
386 end |
259 end |
387 |
260 -- }}} |
388 -- SHIFTY: initialize shifty |
261 |
389 -- the assignment of shifty.taglist must always be after its actually |
262 -- {{{ Mouse bindings |
390 -- initialized with awful.widget.taglist.new() |
|
391 shifty.taglist = mytaglist |
|
392 shifty.init() |
|
393 |
|
394 -- Mouse bindings |
|
395 root.buttons(awful.util.table.join( |
263 root.buttons(awful.util.table.join( |
396 awful.button({}, 3, function() mymainmenu:toggle() end), |
264 awful.button({ }, 3, function () mymainmenu:toggle() end), |
397 awful.button({}, 4, awful.tag.viewnext), |
265 awful.button({ }, 4, awful.tag.viewnext), |
398 awful.button({}, 5, awful.tag.viewprev) |
266 awful.button({ }, 5, awful.tag.viewprev) |
399 )) |
267 )) |
400 |
268 -- }}} |
401 -- key tables |
269 |
402 |
270 -- {{{ Key tables |
403 local tagkeys = { |
271 local global_table = { |
404 -- Shifty: keybindings specific to shifty |
272 my.make_single_key("Up", "View prev", awful.tag.viewprev), |
405 my.make_key("n", "Send to Next Tag", shifty.send_next), -- client to next tag |
273 my.make_single_key("Down", "View next", awful.tag.viewnext), |
406 my.make_key("a", "Add tag", my.mkinteractive(shifty.add)), -- create a new tag |
274 my.make_single_key("Escape", "Restore history", awful.tag.history.restore), |
407 my.make_key("r", "Rename tag", my.mkinteractive(shifty.rename)), -- rename a tag |
275 my.make_single_key("Right", "Next screen", |
408 my.make_key("d", "Delete tag", shifty.del), |
276 function () |
409 my.make_key("Shift+A", "Add tag (no popup)", -- nopopup new tag |
277 awful.client.focus.byidx( 1) |
410 my.mkinteractive(function() shifty.add({nopopup = true}) end)), |
278 if client.focus then client.focus:raise() end |
411 my.make_key("Up", "View prev", |
279 end), |
412 function () awful.tag.viewprev(); return true; end), |
280 my.make_single_key("Left", "Previous screen", |
413 my.make_key("Down", "View next", |
281 function () |
414 function () awful.tag.viewnext(); return true; end), |
282 awful.client.focus.byidx(-1) |
415 -- my.make_key("Shift+Up", "Move tag right", |
283 if client.focus then client.focus:raise() end |
416 -- function() |
284 end), |
417 -- local t = awful.tag.selected() |
285 my.make_single_key("w", "Main menu", function () mymainmenu:show() end), |
418 -- local s = awful.util.cycle(screen.count(), t.screen + 1) |
286 my.make_single_key("Shift+Right", "Swap with next", |
419 -- awful.tag.history.restore() |
287 function () awful.client.swap.byidx( 1); end), |
420 -- t = shifty.tagtoscr(s, t) |
288 my.make_single_key("Shift+Left", "Swap with prev", |
421 -- awful.tag.viewonly(t) |
289 function () awful.client.swap.byidx(-1); end), |
422 -- return true |
290 -- Is this work ? |
423 -- end), |
291 my.make_single_key("Control+Right", "Focus next screen", |
424 -- my.make_key("Shift+Down", "Move tag left", |
292 function () awful.screen.focus_relative( 1); end), |
425 -- function() |
293 -- Is this work ? |
426 -- local t = awful.tag.selected() |
294 my.make_single_key("Control+Left", "Focus prev screen", |
427 -- local s = screen.count() + t.screen - 1 |
295 function () awful.screen.focus_relative(-1); end), |
428 -- s = awful.util.cycle(screen.count(), s) |
296 my.make_single_key("u", "Go to urgent", |
429 -- awful.tag.history.restore() |
297 function () awful.client.urgent.jumpto(); end), |
430 -- t = shifty.tagtoscr(s, t) |
298 my.make_single_key("Tab", "Next client", |
431 -- awful.tag.viewonly(t) |
299 function () |
432 -- return true |
300 awful.client.focus.history.previous() |
433 -- end), |
301 if client.focus then |
|
302 client.focus:raise() |
|
303 end |
|
304 end), |
|
305 my.make_single_key("Return", "Start terminal", my.mkspawn(terminal)), |
|
306 my.make_single_key("Control+r", "Restart", awesome.restart), |
|
307 my.make_single_key("Shift+q", "Quit", logout), |
|
308 my.make_single_key("l", "Inc Master Size", |
|
309 function () awful.tag.incmwfact( 0.05 ) end), |
|
310 my.make_single_key("h", "Dec Master Size", |
|
311 function () awful.tag.incmwfact( -0.05 ) end), |
|
312 my.make_single_key("Shift+l", "Inc Master Count", |
|
313 function () awful.tag.incnmaster( 1 ) end), |
|
314 my.make_single_key("Shift+h", "Dec Master Count", |
|
315 function () awful.tag.incnmaster( -1 ) end), |
|
316 my.make_single_key("Control+l", "Inc Column Count", |
|
317 function () awful.tag.incncol( 1 ) end), |
|
318 my.make_single_key("Control+h", "Dec Column Count", |
|
319 function () awful.tag.incncol( -1 ) end), |
|
320 my.make_single_key("Space", "Next layout", |
|
321 function () awful.layout.inc(layouts, 1 ) end), |
|
322 my.make_single_key("Shift+Space", "Prev layout", |
|
323 function () awful.layout.inc(layouts, -1 ) end), |
|
324 my.make_single_key("Control+n", "Restore clients", awful.client.restore), |
|
325 my.make_single_key("r", "Run", |
|
326 function () mypromptbox[mouse.screen]:run() end), |
|
327 my.make_single_key("x", "Lua prompt", |
|
328 function () |
|
329 awful.prompt.run({ prompt = "Run Lua code: " }, |
|
330 mypromptbox[mouse.screen].widget, |
|
331 awful.util.eval, nil, |
|
332 awful.util.getdir("cache") .. "/history_eval") |
|
333 end), |
|
334 -- This one returns an error. |
|
335 my.make_single_key("p", "Menu bar", function () menubar.show() end) |
434 } |
336 } |
435 |
337 |
436 local awesome_keys = { |
338 client_table = { |
437 my.make_key("m", "Menu", my.mkinteractive(function () |
339 my.make_single_key("f", "Toggle fullscreen", |
438 mymainmenu:show({keygrabber=true}) |
340 function (c) c.fullscreen = not c.fullscreen end), |
439 return true |
341 my.make_single_key("Shift+c", "Kill client", function (c) c:kill() end), |
440 end)), |
342 my.make_single_key("Control+Space", "Toggle floating", awful.client.floating.toggle), |
441 -- my.make_key("k", "Kill all clients", |
343 my.make_single_key("o", "Move to screen", awful.client.movetoscreen), |
442 -- function () |
344 my.make_single_key("t", "Toggle on top", function (c) c.ontop = not c.ontop end), |
443 -- for client. |
345 my.make_single_key("n", "Iconized", |
444 -- my.kill_all(function (c) |
346 function (c) |
445 my.make_key("r", "Restart", awesome.restart), |
347 -- The client currently has the input focus, so it cannot be |
446 my.make_key("q", "Quit", logout), |
348 -- minimized, since minimized clients can't have the focus. |
447 my.make_key("t", "Terminal", my.mkspawn(terminal)), |
349 c.minimized = true |
448 my.make_key("f", "Toggle sloppy mouse", my.sloppy_toggle) |
350 end), |
|
351 my.make_single_key("m", "Toggle maximized", |
|
352 function (c) |
|
353 maximized = not c.maximized_horizontal |
|
354 c.maximized_horizontal = maximized |
|
355 c.maximized_vertical = maximized |
|
356 end), |
|
357 my.make_single_key("Shift+t", "Toggle mark", awful.client.togglemarked) |
449 } |
358 } |
450 |
359 -- }}} |
451 local layout_keys = { |
360 |
452 my.make_key("Right", "Focus right", |
361 -- {{{ Key bindings |
453 function () awful.client.focus.bydirection("right"); return true end), |
|
454 my.make_key("Left", "Focus left", |
|
455 function () awful.client.focus.bydirection("left"); return true end), |
|
456 my.make_key("Up", "Focus up", |
|
457 function () awful.client.focus.bydirection("up"); return true end), |
|
458 my.make_key("Down", "Focus down", |
|
459 function () awful.client.focus.bydirection("down"); return true end), |
|
460 my.make_key("Shift+Right", "Move right", |
|
461 function () awful.client.swap.bydirection("right"); return true end), |
|
462 my.make_key("Shift+Left", "Move left", |
|
463 function () awful.client.swap.bydirection("left"); return true end), |
|
464 my.make_key("Shift+Up", "Move up", |
|
465 function () awful.client.swap.bydirection("up"); return true end), |
|
466 my.make_key("Shift+Down", "Move down", |
|
467 function () awful.client.swap.bydirection("down"); return true end), |
|
468 -- my.make_key("Right", "Focus next", |
|
469 -- function () awful.client.focus.byidx(1); return true end), |
|
470 -- my.make_key("Left", "Focus prev", |
|
471 -- function () awful.client.focus.byidx(-1); return true end), |
|
472 -- my.make_key("Shift+Right", "Move next", |
|
473 -- function() awful.client.swap.byidx(1); return true end), |
|
474 -- my.make_key("Shift+Left", "Move previous", |
|
475 -- function() awful.client.swap.byidx(-1); return true end), |
|
476 -- my.make_key("Shift+Right", "Move next", |
|
477 -- function() awful.screen.focus(1); return true end), |
|
478 -- my.make_key("Shift+Left", "Move previous", |
|
479 -- function() awful.screen.focus(-1); return true end), |
|
480 my.make_key("c", "Master grow", |
|
481 function() awful.tag.incmwfact(0.05); return true end), |
|
482 my.make_key("z", "Master shrink", |
|
483 function() awful.tag.incmwfact(-0.05); return true end), |
|
484 my.make_key("Shift+c", "Add master windows", |
|
485 function() awful.tag.incnmaster(1); return true end), |
|
486 my.make_key("Shift+z", "Remove master windows", |
|
487 function() awful.tag.incnmaster(-1); return true end), |
|
488 my.make_key("Control+c", "Add column", |
|
489 function() awful.tag.incncol(1); return true end), |
|
490 my.make_key("Control+z", "Remove column", |
|
491 function() awful.tag.incncol(-1); return true end), |
|
492 my.make_key("Space", "Next layout", |
|
493 function() awful.layout.inc(layouts, 1); return true end), |
|
494 my.make_key("Shift+_", "Previous layout", |
|
495 function() awful.layout.inc(layouts, -1) ; return true end), |
|
496 } |
|
497 |
|
498 media_keys = { |
|
499 -- media keys |
|
500 my.make_key("XF86HomePage", "Browser", my.mkspawn(browser)), |
|
501 my.make_key("XF86Mail", "Mail", my.mkspawn(mail)), |
|
502 my.make_key("XF86Search", "Search file...", my.mkspawn(lookup)), |
|
503 my.make_key("XF86Explorer", "File Manager", my.mkspawn(filemanager)), |
|
504 my.make_key("XF86Calculator", "Calculator", my.mkspawn(calculator)), |
|
505 my.make_key("XF86Tools", "Music", my.mkspawn(musicplayer)), |
|
506 my.make_key("XF86AudioPrev", "Previous song", my.mkspawn("mpc prev")), |
|
507 my.make_key("XF86AudioNext", "Next song", my.mkspawn("mpc next")), |
|
508 my.make_key("XF86AudioPlay", "Play song", my.mkspawn("mpc toggle")), |
|
509 my.make_key("XF86AudioMute", "Mute", my.mkspawn("pulseaudio-ctl mute")), |
|
510 my.make_key("XF86AudioLowerVolume", "Volume down", my.mkspawn("pulseaudio-ctl down")), |
|
511 my.make_key("XF86AudioRaiseVolume", "Volume up", my.mkspawn("pulseaudio-ctl up")), |
|
512 my.make_key("XF86Eject", "Eject", my.mkspawn("eject")), |
|
513 } |
|
514 |
|
515 global_table = { |
|
516 my.make_key("Escape", "Restore History", awful.tag.history.restore), |
|
517 my.make_key("e", "Revel windows", revelation), |
|
518 my.make_key("c", "Previous tag", awful.tag.viewprev), |
|
519 my.make_key("z", "Next tag", awful.tag.viewnext), |
|
520 my.make_key("Right", "Right client", my.make_focus_bydirection("right")), |
|
521 my.make_key("Left", "Left client", my.make_focus_bydirection("left")), |
|
522 my.make_key("Up", "Up client", my.make_focus_bydirection("up")), |
|
523 my.make_key("Down", "Down client", my.make_focus_bydirection("down")), |
|
524 my.make_key("u", "Jump to urgent", awful.client.urgent.jumpto), |
|
525 my.make_key("Tab", "Previous client", |
|
526 function() |
|
527 awful.client.focus.history.previous() |
|
528 if client.focus then |
|
529 client.focus:raise() |
|
530 end |
|
531 end), |
|
532 |
|
533 -- Prompt |
|
534 my.make_key("F2", "Run...", function() |
|
535 awful.prompt.run({prompt = "Run: "}, |
|
536 mypromptbox[mouse.screen].widget, |
|
537 awful.util.spawn, awful.completion.shell, |
|
538 awful.util.getdir("cache") .. "/history") |
|
539 end), |
|
540 |
|
541 my.make_key("F3", "Eval...", function() |
|
542 awful.prompt.run({prompt = "Run Lua code: "}, |
|
543 mypromptbox[mouse.screen].widget, |
|
544 awful.util.eval, nil, |
|
545 awful.util.getdir("cache") .. "/history_eval") |
|
546 end), |
|
547 |
|
548 -- modal key binding |
|
549 my.make_key("a", "Main mode", my.make_kt(awesome_keys, "awesome") ), |
|
550 my.make_key("t", "Tag mode...", my.make_kt(tagkeys, "tag") ), |
|
551 my.make_key("l", "layout mode...", my.make_kt(layout_keys, "layout") ), |
|
552 } |
|
553 |
|
554 client_keytable = { |
|
555 my.make_key("F4", "Kill client", |
|
556 function(c) c:kill() end), |
|
557 my.make_key("k", "Kill client", |
|
558 function(c) c:kill() end), |
|
559 my.make_key("f", "Toggle fullscreen", |
|
560 function(c) c.fullscreen = not c.fullscreen end), |
|
561 my.make_key("space", "Toggle floating", |
|
562 awful.client.floating.toggle), |
|
563 my.make_key("m", "Toggle maximize", |
|
564 function(c) |
|
565 c.maximized_horizontal = not c.maximized_horizontal |
|
566 c.maximized_vertical = not c.maximized_vertical |
|
567 end), |
|
568 my.make_key("h", "Toggle minimized", |
|
569 function (c) |
|
570 c.minimized = not c.minimized |
|
571 end), |
|
572 my.make_key("Return", "Swap master", |
|
573 function(c) |
|
574 c:swap(awful.client.getmaster()) |
|
575 end), |
|
576 my.make_key("o", "Move to screen", awful.client.movetoscreen), |
|
577 } |
|
578 |
|
579 -- Key bindings |
|
580 globalkeys = awful.util.table.join( |
362 globalkeys = awful.util.table.join( |
581 awful.key({modkey}, "F1", function () my.show_kt(global_table, "Global binding") end), |
363 awful.key({modkey}, "F1", function () my.show_kt(global_table, "Global binding") end), |
582 my.make_globalkeys({modkey}, global_table), |
364 -- make the client binding help available even when there is no client. |
583 my.make_globalkeys({}, media_keys), |
365 awful.key({modkey, "Shift"}, "F1", |
584 -- forcing restart of mpd. |
366 function () my.show_kt(client_table, "Client binding") end), |
585 -- it sometime have difficulty to connect to pulse |
367 my.make_globalkeys({modkey}, global_table) |
586 awful.key({modkey}, "F6", function () |
368 ) |
587 awful.util.spawn("pkill -9 mpd") |
369 |
588 awful.util.spawn("mpd") |
|
589 end) |
|
590 ) |
|
591 |
|
592 |
|
593 -- Client awful tagging: this is useful to tag some clients and then do stuff |
|
594 -- like move to tag on them |
|
595 clientkeys = awful.util.table.join( |
370 clientkeys = awful.util.table.join( |
596 awful.key({modkey, "Shift"}, "F1", |
371 my.make_globalkeys({modkey}, client_table) |
597 function () my.show_kt(client_keytable, "Client binding") end), |
372 ) |
598 my.make_globalkeys({modkey}, client_keytable), |
373 |
599 awful.key({modkey, "Shift"}, "r", function(c) c:redraw() end), |
374 -- Bind all key numbers to tags. |
600 awful.key({modkey, "Shift"}, "t", awful.client.togglemarked)) |
375 -- Be careful: we use keycodes to make it works on any keyboard layout. |
601 |
376 -- This should map on the top row of your keyboard, usually 1 to 9. |
602 |
377 for i = 1, 9 do |
603 -- SHIFTY: assign client keys to shifty for use in |
378 globalkeys = awful.util.table.join(globalkeys, |
604 -- match() function(manage hook) |
379 -- View tag only. |
605 shifty.config.clientkeys = clientkeys |
380 awful.key({ modkey }, "#" .. i + 9, |
606 shifty.config.modkey = modkey |
381 function () |
607 |
382 local screen = mouse.screen |
608 -- Compute the maximum number of digit we need, limited to 10 |
383 local tag = awful.tag.gettags(screen)[i] |
609 local number_row = { |
384 if tag then |
610 '"', '<', '>', '(', ')', |
385 awful.tag.viewonly(tag) |
611 '@', '+', '-', '/', '*' |
386 end |
|
387 end), |
|
388 -- Toggle tag. |
|
389 awful.key({ modkey, "Control" }, "#" .. i + 9, |
|
390 function () |
|
391 local screen = mouse.screen |
|
392 local tag = awful.tag.gettags(screen)[i] |
|
393 if tag then |
|
394 awful.tag.viewtoggle(tag) |
|
395 end |
|
396 end), |
|
397 -- Move client to tag. |
|
398 awful.key({ modkey, "Shift" }, "#" .. i + 9, |
|
399 function () |
|
400 if client.focus then |
|
401 local tag = awful.tag.gettags(client.focus.screen)[i] |
|
402 if tag then |
|
403 awful.client.movetotag(tag) |
|
404 end |
|
405 end |
|
406 end), |
|
407 -- Toggle tag. |
|
408 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, |
|
409 function () |
|
410 if client.focus then |
|
411 local tag = awful.tag.gettags(client.focus.screen)[i] |
|
412 if tag then |
|
413 awful.client.toggletag(tag) |
|
414 end |
|
415 end |
|
416 end)) |
|
417 end |
|
418 |
|
419 clientbuttons = awful.util.table.join( |
|
420 awful.button({ }, 1, function (c) client.focus = c; c:raise() end), |
|
421 awful.button({ modkey }, 1, awful.mouse.client.move), |
|
422 awful.button({ modkey }, 3, awful.mouse.client.resize)) |
|
423 |
|
424 -- Set keys |
|
425 root.keys(globalkeys) |
|
426 -- }}} |
|
427 |
|
428 -- {{{ Rules |
|
429 -- Rules to apply to new clients (through the "manage" signal). |
|
430 awful.rules.rules = { |
|
431 -- All clients will match this rule. |
|
432 { rule = { }, |
|
433 properties = { border_width = beautiful.border_width, |
|
434 border_color = beautiful.border_normal, |
|
435 focus = awful.client.focus.filter, |
|
436 raise = true, |
|
437 keys = clientkeys, |
|
438 buttons = clientbuttons } }, |
|
439 { rule = { class = "MPlayer" }, |
|
440 properties = { floating = true } }, |
|
441 { rule = { class = "pinentry" }, |
|
442 properties = { floating = true } }, |
|
443 { rule = { class = "gimp" }, |
|
444 properties = { floating = true } }, |
|
445 -- Set Firefox to always map on tags number 2 of screen 1. |
|
446 -- { rule = { class = "Firefox" }, |
|
447 -- properties = { tag = tags[1][2] } }, |
612 } |
448 } |
613 |
449 -- }}} |
614 for i = 1, (shifty.config.maxtags or #number_row) do |
450 |
615 local k = number_row[i-1] |
451 -- {{{ Signals |
616 globalkeys = awful.util.table.join( |
452 -- Signal function to execute when a new client appears. |
617 globalkeys, |
453 client.connect_signal("manage", function (c, startup) |
618 awful.key({modkey}, k, function() |
454 -- Enable sloppy focus |
619 local t = awful.tag.viewonly(shifty.getpos(i-1)) |
455 -- c:connect_signal("mouse::enter", function(c) |
620 end), |
456 -- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier |
621 awful.key({modkey, "Control"}, k, function() |
457 -- and awful.client.focus.filter(c) then |
622 local t = shifty.getpos(i-1) |
458 -- client.focus = c |
623 t.selected = not t.selected |
459 -- end |
624 end), |
460 -- end) |
625 awful.key({modkey, "Control", "Shift"}, k, function() |
461 |
626 if client.focus then |
462 if not startup then |
627 awful.client.toggletag(shifty.getpos(i-1)) |
463 -- Set the windows at the slave, |
628 end |
464 -- i.e. put it at the end of others instead of setting it master. |
629 end), |
465 -- awful.client.setslave(c) |
630 -- move clients to other tags |
466 |
631 awful.key({modkey, "Shift"}, k, function() |
467 -- Put windows in a smart way, only if they does not set an initial position. |
632 if client.focus then |
468 if not c.size_hints.user_position and not c.size_hints.program_position then |
633 t = shifty.getpos(i-1) |
469 awful.placement.no_overlap(c) |
634 awful.client.movetotag(t) |
470 awful.placement.no_offscreen(c) |
635 awful.tag.viewonly(t) |
471 end |
636 end |
472 elseif not c.size_hints.user_position and not c.size_hints.program_position then |
637 end)) |
473 -- Prevent clients from being unreachable after screen count change |
638 end |
474 awful.placement.no_offscreen(c) |
639 |
475 end |
640 -- Set keys |
476 |
641 -- mympdwidget:append_global_keys() |
477 if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then |
642 -- keychains.init(globalkeys,{}) |
478 -- buttons for the titlebar |
643 root.keys(globalkeys) |
479 local buttons = awful.util.table.join( |
644 |
480 awful.button({ }, 1, function() |
645 -- local function kt2kc(kt) |
481 client.focus = c |
646 -- t = {} |
482 c:raise() |
647 -- for _,k in ipairs(kt) do |
483 awful.mouse.client.move(c) |
648 -- t[k.key] = { func = k.func, info = key.desc } |
484 end), |
649 -- end |
485 awful.button({ }, 3, function() |
650 -- return t |
486 client.focus = c |
651 -- end |
487 c:raise() |
652 -- keychains.add({modkey}, "w", "Awesome", nil, kt2kc(awesome_keys)) |
488 awful.mouse.client.resize(c) |
653 -- keychains.start(5) |
489 end) |
654 |
490 ) |
655 -- Hook function to execute when focusing a client. |
491 |
656 client.connect_signal("focus", |
492 -- Widgets that are aligned to the left |
657 function(c) |
493 local left_layout = wibox.layout.fixed.horizontal() |
658 if not awful.client.ismarked(c) then |
494 left_layout:add(awful.titlebar.widget.iconwidget(c)) |
659 c.border_color = beautiful.border_focus |
495 left_layout:buttons(buttons) |
660 c.opacity = 1.0 |
496 |
661 end |
497 -- Widgets that are aligned to the right |
|
498 local right_layout = wibox.layout.fixed.horizontal() |
|
499 right_layout:add(awful.titlebar.widget.floatingbutton(c)) |
|
500 right_layout:add(awful.titlebar.widget.maximizedbutton(c)) |
|
501 right_layout:add(awful.titlebar.widget.stickybutton(c)) |
|
502 right_layout:add(awful.titlebar.widget.ontopbutton(c)) |
|
503 right_layout:add(awful.titlebar.widget.closebutton(c)) |
|
504 |
|
505 -- The title goes in the middle |
|
506 local middle_layout = wibox.layout.flex.horizontal() |
|
507 local title = awful.titlebar.widget.titlewidget(c) |
|
508 title:set_align("center") |
|
509 middle_layout:add(title) |
|
510 middle_layout:buttons(buttons) |
|
511 |
|
512 -- Now bring it all together |
|
513 local layout = wibox.layout.align.horizontal() |
|
514 layout:set_left(left_layout) |
|
515 layout:set_right(right_layout) |
|
516 layout:set_middle(middle_layout) |
|
517 |
|
518 awful.titlebar(c):set_widget(layout) |
|
519 end |
662 end) |
520 end) |
663 |
521 |
664 -- Hook function to execute when unfocusing a client. |
522 client.connect_signal("focus", |
665 client.connect_signal("unfocus", function(c) |
523 function(c) |
666 if not awful.client.ismarked(c) then |
524 c.border_color = beautiful.border_focus |
667 c.border_color = beautiful.border_normal |
|
668 c.opacity = 0.8 |
|
669 end |
|
670 end) |
525 end) |
671 |
526 |
|
527 client.connect_signal("unfocus", |
|
528 function(c) |
|
529 c.border_color = beautiful.border_normal |
|
530 end) |
|
531 -- }}} |
|
532 |
672 my.sloppy_install(0.5) |
533 my.sloppy_install(0.5) |