half-baked re-implementation of the major parts of sdorfehs in Hammerspoon

events: Add spoonfish.apps_to_ignore to negate apps_to_watch

This makes having a default policy of watching everything easier.

+21 -3
+18 -3
events.lua
··· 60 60 61 61 local matched = false 62 62 for _, p in pairs(spoonfish.apps_to_watch) do 63 + if p == "" then 64 + matched = true 65 + break 66 + end 63 67 if not p:find("^%^") then 64 68 p = spoonfish.escape_pattern(p) 65 69 end ··· 67 71 matched = true 68 72 break 69 73 end 70 - if matched then 74 + end 75 + for _, p in pairs(spoonfish.apps_to_ignore) do 76 + if p == "" then 77 + matched = false 78 + break 79 + end 80 + if not p:find("^%^") then 81 + p = spoonfish.escape_pattern(p) 82 + end 83 + if hsapp:title():find(p) then 84 + matched = false 71 85 break 72 86 end 73 87 end 74 88 if not matched then 89 + spoonfish.log.i("ignoring app[" .. hsapp:pid() .. "] " .. hsapp:title() .. 90 + " (" .. hsapp:name() .. ")") 75 91 return 76 92 end 77 93 ··· 98 114 99 115 -- watch a hs.window object to be notified when it is closed or moved 100 116 spoonfish.watch_hswindow = function(hswin) 101 - if not hswin:isStandard() then 102 - spoonfish.log.i(" ignoring non-standard window " .. hswin:title()) 117 + if hswin == nil or not hswin:isStandard() then 103 118 return 104 119 end 105 120
+3
init.lua
··· 38 38 "^" .. spoonfish.terminal, 39 39 "^Firefox", 40 40 } 41 + -- these override apps_to_watch 42 + spoonfish.apps_to_ignore = { 43 + } 41 44 spoonfish.windows_to_ignore = { 42 45 "Picture-in-Picture", 43 46 "^Open ",