-
Notifications
You must be signed in to change notification settings - Fork 632
Open
Description
Recreating
open 2 chrome windows in one space
and 2 chrome windows in another space
switch to a third space
repeatedly press cmd-alt-ctrl-c within 1 seconds
Expected
on first press focuses first chrome window.
successive presses cycles all 4 windows showing the alert
switching to window i/4
Got
on first press focuses last focused chrome window. does not show alert.
successive presses cycles windows in that particular space showing switching to window i/2
things tried
looked through the filter documentation. seems like this is not expected behaviour.
couldn't find similar issues.
hs.loadSpoon("EmmyLua")
function notify(text)
hs.notify.new({title="Hammerspoon", informativeText=text}):send()
end
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function()
hs.reload()
end)
local hotswitch = {
c = "Google Chrome",
d = "Discord",
m = "Messenger",
t = "kitty",
w = "WhatsApp",
p = "Python",
f = "Finder"
}
for key, app in pairs(hotswitch) do
hs.hotkey.bind({ "cmd", "alt", "ctrl" }, key, function()
focusWindow(app)
end)
end
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "h",function ()
local fwin = hs.window.focusedWindow()
-- hs.alert.show(fwin:application())
hs.alert.show(fwin:application())
end)
nextfocus = 1
nextfocuscanceltimer = hs.timer.doAfter(1,function () nextfocus = 1 end)
function focusWindow(hint)
local wf = hs.window.filter.new({hint})
-- wf = wf:allowApp("chrome")
local wins = wf:getWindows()
if (#wins) > 1 then
hs.alert.show('switching to window '..nextfocus..'/' .. #wins)
wins[nextfocus]:focus()
nextfocus = math.min(nextfocus+1, #wins)
nextfocuscanceltimer:setNextTrigger(1)
elseif (#wins) == 1 then
wins[1]:focus()
else
hs.alert.show(hint .. " not found")
end
-- hs.alert.show(wins[1])
-- for _, w in pairs(wf:getWindows()) do
-- hs.alert.show(w)
-- end
end
-- focusWindow("act")
hs.alert.show("config loaded", nil, nil, 0.5)
Metadata
Metadata
Assignees
Labels
No labels