feat(awful: hotkeys): extended matching rules
This commit is contained in:
parent
89cab7a52a
commit
901771e51b
|
@ -9,12 +9,12 @@
|
|||
|
||||
local hotkeys_popup = require("awful.hotkeys_popup.widget")
|
||||
|
||||
local vim_rule = {name="vim"}
|
||||
local vim_rule_any = {name={"vim", "VIM"}}
|
||||
for group_name, group_data in pairs({
|
||||
vim_motion= { color="#009F00", rule=vim_rule },
|
||||
vim_command= { color="#aFaF00", rule=vim_rule },
|
||||
vim_command_insert= { color="#cF4F40", rule=vim_rule },
|
||||
vim_operator= { color="#aF6F00", rule=vim_rule },
|
||||
vim_motion= { color="#009F00", rule_any=vim_rule_any },
|
||||
vim_command= { color="#aFaF00", rule_any=vim_rule_any },
|
||||
vim_command_insert= { color="#cF4F40", rule_any=vim_rule_any },
|
||||
vim_operator= { color="#aF6F00", rule_any=vim_rule_any },
|
||||
}) do
|
||||
hotkeys_popup.group_rules[group_name] = group_data
|
||||
end
|
||||
|
|
|
@ -376,8 +376,15 @@ function widget.show_help(c, s)
|
|||
for group, _ in pairs(group_list) do
|
||||
local need_match
|
||||
for group_name, data in pairs(widget.group_rules) do
|
||||
if group_name==group and data.rule then
|
||||
if not c or not awful.rules.match(c, data.rule) then
|
||||
if group_name==group and (
|
||||
data.rule or data.rule_any or data.except or data.except_any
|
||||
) then
|
||||
if not c or not awful.rules.matches(c, {
|
||||
rule=data.rule,
|
||||
rule_any=data.rule_any,
|
||||
except=data.except,
|
||||
except_any=data.except_any
|
||||
}) then
|
||||
need_match = true
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue