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 icon reappears when opening URLs from certain applications #2234

Closed
zzamboni opened this issue Nov 11, 2019 · 2 comments
Closed

App icon reappears when opening URLs from certain applications #2234

zzamboni opened this issue Nov 11, 2019 · 2 comments

Comments

@zzamboni
Copy link
Contributor

Hammerspoon version 0.9.76 (5104)
macOS 10.15.1 (Catalina)

When Hammerspoon is set to be the default URL handler and the app icon is set to hidden, sometimes the app icon reappears when Hammerspoon is invoked as the URL handler. When this happens, opening the Hammerspoon preferences and enabling/disabling the corresponding option makes the app icon disappear again.

The following minimal init.lua serves to reproduce the problem:

function dispatchURL(scheme, host, params, fullUrl)
   hs.printf("Dispatching URL '%s'", fullUrl)
   hs.urlevent.openURLWithBundle(fullUrl, "com.google.Chrome")
end

hs.urlevent.httpCallback = dispatchURL
hs.urlevent.setDefaultHandler('http')

The puzzling part is that this seems to happen depending on the application from which the URL is invoked. Here's an informal and incomplete list of my experiments with some of the apps I use:

  • Happens when clicking on a URL in

    • Microsoft Outlook
    • Preview.app
    • Messages.app
  • Doesn't happen when clicking or opening a URL in

    • open terminal command
    • Microsoft Teams
    • Terminal.app (i.e. cmd-double-click on a URL in the Terminal)
    • Station (https://getstation.com/)
    • Evernote
@zzamboni zzamboni changed the title App icon reappears when opening URLs App icon reappears when opening URLs from certain applications Nov 11, 2019
@zzamboni
Copy link
Contributor Author

zzamboni commented Nov 13, 2019

For now I'm using the following as a workaround :)

hide_icon_timer = hs.timer.doEvery(30, hs.dockicon.hide)

Update: don't use this, as it steals focus from the current window every time the timer runs. I tried wrapping hs.dockicon.hide in a function that gets the current window and then focuses it afterwards, but the result seems to be the same.

@zzamboni
Copy link
Contributor Author

I just noticed there's been a lot of discussion around this topic in #2261, so I'm closing this issue in favor of that one.

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

1 participant