From: martin f. krafft Date: Tue, 10 Mar 2020 18:58:00 +0000 (+0100) Subject: match targets by pattern X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/6204c603d4bbb23c102819be311e76849735702e?hp=1a082181650a64efa15e235859238491833c39bc match targets by pattern --- diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 2b5b2a8..fce9a05 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -329,9 +329,10 @@ awful.screen.connect_for_each_screen(function(s) end) -- }}} -- {{{ autorandr integration -local function find_screen_by_name(name) +local function find_screen_by_pattern(pattern) for s in screen do - if s.name == name then + print(s.name .. " :: " .. pattern) + if s.name:match(pattern) then return s end end @@ -350,7 +351,7 @@ local function get_target_screen_for_tag(tag) if tag.targets then if type(tag.targets) == "table" then for _,target in ipairs(tag.targets) do - local s = find_screen_by_name(target) + local s = find_screen_by_pattern(target:gsub('%-', '%%-')) if s then print(" → screen " .. s.name) return s