keydoc: add documentation of various keybindings

This work by monkey-patching awful.key to include documentation. The
documentation is available through modkey + F1.
This commit is contained in:
Vincent Bernat 2012-07-14 21:21:52 +02:00
parent 47115a0fbe
commit a79215d4dc
6 changed files with 193 additions and 43 deletions

View file

@ -2,6 +2,7 @@ config.keys = {}
config.mouse = {}
local volume = loadrc("volume", "vbe/volume")
local brightness = loadrc("brightness", "vbe/brightness")
local keydoc = loadrc("keydoc", "vbe/keydoc")
local function client_info()
local v = ""
@ -35,72 +36,94 @@ local function client_info()
end
config.keys.global = awful.util.table.join(
-- Tag navigation
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
-- Focus
keydoc.group("Focus"),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
end,
"Focus next window"),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
-- Layout manipulation
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(config.layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(config.layouts, -1) end),
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
end,
"Focus previous window"),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
end,
"Focus previously focused window"),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
"Jump to urgent-flagged window"),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
"Jump to next screen"),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
keydoc.group("Layout manipulation"),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
"Increase master-width factor"),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
"Decrease master-width factor"),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster( 1) end,
"Increase number of masters"),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(-1) end,
"Decrease number of masters"),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol( 1) end,
"Increase number of columns"),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol(-1) end,
"Decrease number of columns"),
awful.key({ modkey, }, "space", function () awful.layout.inc(config.layouts, 1) end,
"Next layout"),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(config.layouts, -1) end,
"Previous layout"),
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
"Swap with next window"),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
"Swap with previous window"),
-- Spawn a terminal
awful.key({ modkey, }, "Return", function () awful.util.spawn(config.terminal) end),
keydoc.group("Misc"),
awful.key({ modkey, }, "Return", function () awful.util.spawn(config.terminal) end,
"Spawn a terminal"),
-- Restart awesome
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Control" }, "r", awesome.restart, "Restart awesome"),
-- Multimedia keys
awful.key({ }, "XF86MonBrightnessUp", brightness.increase),
awful.key({ }, "XF86MonBrightnessDown", brightness.decrease),
awful.key({ }, "XF86AudioRaiseVolume", volume.increase),
awful.key({ }, "XF86AudioLowerVolume", volume.decrease),
awful.key({ }, "XF86AudioMute", volume.toggle)
awful.key({ }, "XF86AudioMute", volume.toggle),
-- Help
awful.key({ modkey, }, "F1", keydoc.display)
)
config.keys.client = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, }, "x", function (c) c:kill() end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "i", client_info),
keydoc.group("Window-specific bindings"),
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end,
"Fullscreen"),
awful.key({ modkey, }, "x", function (c) c:kill() end,
"Close"),
awful.key({ modkey, }, "o", awful.client.movetoscreen, "Move to the other screen"),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, "Toggle floating"),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
"Switch with master window"),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
"Stay on top"),
awful.key({ modkey, }, "i", client_info,
"Get client-related information"),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
end,
"Maximize")
)
config.mouse.client = awful.util.table.join(