-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.lua
31 lines (26 loc) · 1.01 KB
/
common.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local capi = {timer = timer,root=root,client=client,mouse=mouse}
local aw_util = require( "awful.util" )
local aw_key = require( "awful.key" )
local glib = require( "lgi" ).GLib
-- Store shared variables
local module = {fav={},already_set={},other_shortcuts=setmetatable({}, { __mode = 'k' })}
local to_be_applied = {}
function module.delated_hook_key(key,mods,fct,fav_hash)
if #to_be_applied == 0 then
glib.idle_add(glib.PRIORITY_DEFAULT_IDLE, function()
--TODO
end)
end
table.insert(to_be_applied, nil)
end
-- Add a new keybinding to 'key' if not already set
function module.hook_key(key,mods,fct,fav_hash)
if not module.already_set[fav_hash or key] then --TODO handle replacment for shortcuts
capi.root.keys(aw_util.table.join(capi.root.keys(),aw_key(mods or {}, key, function ()
local f = ((fct) or (module.fav[key]))
f()
end)))
module.already_set[fav_hash or key] = true
end
end
return module