From 1bec10d5d856d839cc110e182d629f941d5303e9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 27 Dec 2018 10:14:33 +0100 Subject: [PATCH] Add support for exit_code and handle "Escape" in keys Fixes https://github.com/blueyed/awesome-cyclefocus/issues/17. --- init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fe47736..9f15236 100644 --- a/init.lua +++ b/init.lua @@ -638,6 +638,14 @@ cyclefocus.cycle = function(startdirection_or_args, args) local cycle_filters = awful.util.table.join(args.cycle_filters or {}, cyclefocus.cycle_filters) + -- Use "Escape" as exit_key if not used as key. + local exit_key = args.exit_key + if exit_key == nil then + if not awful.util.table.hasitem(keys, 'Escape') then + exit_key = 'Escape' + end + end + local filter_result_cache = {} -- Holds cached filter results. local show_clients = args.show_clients @@ -835,8 +843,7 @@ cyclefocus.cycle = function(startdirection_or_args, args) .. ", event: " .. tostring(event) .. ", modifier_key: " .. tostring(modifier), 3) - -- Abort on Escape. - if key == 'Escape' then + if exit_key and key == exit_key then return exit_grabber(initiating_client) end