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

Dock goodies #138

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Dock goodies #138

merged 1 commit into from
Nov 26, 2024

Conversation

simonhamp
Copy link
Member

Adds support for:

  • Bouncing the Dock icon
  • Setting the badge value
  • Changing the icon
  • Toggling icon visibility

@SRWieZ
Copy link
Contributor

SRWieZ commented Nov 19, 2024

I saw somewhere that app.dock could be null since it's only for MacOS. So maybe use dock?.show()?

I dug into that today. I would even dare to say that I have a pretty good understanding of the ins and outs of Native PHP.


Why you ask 😁 ?

I wanted to fix a bug, and I kind of did, but it's ugly.

The bug I encountered:

  • Build your app (a menubar app, important detail)
  • Install it
  • Launch it
  • Without closing it, try to relaunch it
  • You now have the icon in the dock, without really any window attached to it. I tried "File => Close window (CMD+W)" but it didn't work.

So here is my fix, it flashes the dock icon now

app.on("activate", function (event, hasVisibleWindows) {
    // ...
   // if(state.activeMenuBar.showDockIcon === false) // doesn't work either, doesn't now why.
      app.dock?.hide();
      event.preventDefault();
}

I didn't find the cause (and my computer is not powerful enough to compile that much).

I put it there in case you have any idea 😉. If not, I will open an issue to keep track of it.

@simonhamp
Copy link
Member Author

I saw somewhere that app.dock could be null since it's only for MacOS. So maybe use dock?.show()?

Good point @SRWieZ. But the Dock API (in NativePHP) has been like this since inception and I don't recall seeing any reports of issues... but maybe folks aren't doing much cross-platform stuff yet. I will test it out on Windows before merging this.


For your issue, I'm not sure I understand the impact on this PR - that sounds like a problem elsewhere... can you raise it as an issue and maybe put a quick screen recording to demo what you're seeing and how to reproduce?

@SRWieZ
Copy link
Contributor

SRWieZ commented Nov 20, 2024

No direct impact on this PR.
I saw you were working on the Menubar and Dock, so I mentioned it side to my app.dock being null note.

NativePHP/laravel#425

@simonhamp
Copy link
Member Author

Tested on Windows and it's a no-op, so I think this is ok

@simonhamp simonhamp merged commit 41e4650 into main Nov 26, 2024
3 of 10 checks passed
@simonhamp simonhamp deleted the feature/dock branch November 26, 2024 14:15
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

Successfully merging this pull request may close these issues.

2 participants