Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app:hide() not work for some specific apps and always returns false #3580

Open
keidarcy opened this issue Jan 5, 2024 · 3 comments
Open

Comments

@keidarcy
Copy link

keidarcy commented Jan 5, 2024

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

@theutz
Copy link

theutz commented Mar 4, 2024

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

@gandhiShepard
Copy link

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)

@eddyg
Copy link

eddyg commented May 31, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants