Bindings: change API to make bindings module responsible for all bindings
This commit is contained in:
parent
6a5115bc7b
commit
8abc0819df
13
bindings.lua
13
bindings.lua
|
@ -9,6 +9,8 @@ local modkey = conf.modkey or "Mod4"
|
|||
local mb = require("modalbind")
|
||||
local calendar = require("calendar")
|
||||
|
||||
local globalkeys = {}
|
||||
|
||||
app_folders = {
|
||||
"/usr/share/applications",
|
||||
"/usr/local/share/applications",
|
||||
|
@ -90,8 +92,8 @@ layoutsettings = {
|
|||
C = { func = function () awful.tag.incncol(-1) end, desc = "Less columns" },
|
||||
}
|
||||
|
||||
function bindings.extend_key_table(globalkeys)
|
||||
return awful.util.table.join(globalkeys or {},
|
||||
function bindings.setup()
|
||||
globalkeys = awful.util.table.join(
|
||||
awful.key({ }, "Pause", spawnf('wmselect')), -- old keyboard
|
||||
awful.key({ }, "Print", spawnf('wmselect')), -- new keyboard
|
||||
|
||||
|
@ -203,6 +205,13 @@ function bindings.extend_key_table(globalkeys)
|
|||
--}}}
|
||||
end
|
||||
|
||||
function bindings.add_bindings(keys)
|
||||
globalkeys = awful.util.table.join(globalkeys, keys);
|
||||
end
|
||||
|
||||
function bindings.apply()
|
||||
root.keys(globalkeys)
|
||||
end
|
||||
|
||||
local function client_opacity_set(c, default, max, step)
|
||||
if c.opacity < 0 or c.opacity > 1 then
|
||||
|
|
8
rc.lua
8
rc.lua
|
@ -57,14 +57,12 @@ end
|
|||
-- }}}
|
||||
|
||||
-- {{{ Key bindings
|
||||
globalkeys = {}
|
||||
globalkeys = tags.extend_key_table(globalkeys);
|
||||
|
||||
bindings = require("bindings")
|
||||
bindings.setup()
|
||||
bindings.modalbind.set_x_offset(18)
|
||||
globalkeys = bindings.extend_key_table(globalkeys)
|
||||
|
||||
root.keys(globalkeys)
|
||||
bindings.add_bindings(tags.create_bindings())
|
||||
bindings.apply()
|
||||
-- }}}
|
||||
|
||||
-- {{{ rules
|
||||
|
|
4
tags.lua
4
tags.lua
|
@ -84,14 +84,14 @@ function tags.setup(setuptable)
|
|||
end
|
||||
end
|
||||
|
||||
function tags.extend_key_table(globalkeys)
|
||||
function tags.create_bindings()
|
||||
-- Compute the maximum number of digit we need, limited to 22
|
||||
keynumber = 0
|
||||
for s = 1, screen.count() do
|
||||
keynumber = math.min(22, math.max(#(list[s]), keynumber));
|
||||
end
|
||||
|
||||
local tagkeys = globalkeys or {}
|
||||
local tagkeys = {}
|
||||
|
||||
-- Bind all key numbers to tags, using keycodes
|
||||
for i = 1, keynumber do
|
||||
|
|
Loading…
Reference in a new issue