hammerspoon
hammerspoon copied to clipboard
`app:hide()` not work for some specific apps and always returns `false`
Chrome works fine with app:hide()
but ARC not and app.hide()
always returns false
even hide()
worked.
local log = hs.logger.new("toggle-me", "debug")
bundleId = "com.google.Chrome"
// bundleId = "company.thebrowser.Browser"
local app = hs.application.find("com.google.Chrome")
if app:isFrontmost() then
local h = app:hide()
log.i(h) // alway false
end
I'm binding cmd+h
for arc
as a workaround.
I have accessibility enabled.
More details in my runnning script: hide,bind cmd + h
I found a quick-and-dirty workaround:
local name
if app and app.name then
name = app.name
elseif type(app) == "string" then
name = app
end
if name then curr:selectMenuItem("Hide " .. name) end
I have the same problem. This works for all apps except ARC
hs.hotkey.bind({"cmd", "alt"}, "a", function()
local arc = hs.application.find("arc")
if arc:isFrontmost() then
arc:hide()
else
hs.application.launchOrFocus("/Applications/Arc.app")
end
end)
Came here to report the same problem and found this issue.
For now, I'm special-casing Arc in my openOrHideOrShowApp
key-handler function and calling selectMenuItem
instead of hide
when isFrontmost
is Arc (just like @theutz suggested above).
Any idea what's "special" about Arc?
ARC likely isn't properly implementing Accessibility, which is the interface by which we're able to hide/unhide apps. That being the case, there isn't much we can do about it other than add workarounds in configs like those shown here.