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

Implement macOS-style menus on macOS #4

Open
msgilligan opened this issue Jul 14, 2018 · 6 comments
Open

Implement macOS-style menus on macOS #4

msgilligan opened this issue Jul 14, 2018 · 6 comments

Comments

@msgilligan
Copy link
Contributor

msgilligan commented Jul 14, 2018

I have used NSMenuFx before with good results.

Is this something you'd like to include? If so, I might try my hand at a PR.

@aalmiray
Copy link
Owner

I'm undecided on this issue. At first the application supported the OSX menu but you can't get menu icons to work with what GroovyFX offers out of the box. Then decided to keep it consistent across platforms and not use the System menu bar.

What's your experience with NSMenuFX? Do you see any potential issues with it?

@msgilligan
Copy link
Contributor Author

msgilligan commented Jul 14, 2018

I have strong feelings on this issue. As a user I expect desktop applications to look native on whatever platform I'm using and I consider apps that don't have a native look-and-feel to be inferior. As a developer, I'm only interested in using JavaFX if I can produce native-looking apps for the top 2 (Windows, macOS) or 3 (Linux) desktop platforms.

I'd really like to see macOS menu support built-in to JavaFX, of course. I know there have been some efforts to do that, but am not sure where they stand. Perhaps once JavaFX is a standalone component, it will be easier to integrate or create a fork that supports macOS menus. In my opinion lack of macOS menu support is a major flaw and barrier to adoption of JavaFX.

When I chose it, NSMenuFX looked to me like the best solution out there. I'm in the process of updating my app (which I ship with javapackager) to Java 10 and had to update to the latest NSMenuFX to get it to work -- but it seems like it is working well with Java 10. I'm hoping to release a new version in the next week or so. (With Java 10 if I can get it to work, with Java 8 otherwise) I'll let you know how that goes.

I've been impressed with NSMenuFX. I've reported some issues and made some minor contributions. @0x4a616e has been helpful and responsive. I've been able to get the app to look and work like a macOS native app -- and have received positive feedback from Mac users. The biggest tip-off that it is a Java app is the 200MB size. I'm hoping Java 10/11 and jlink will help reduce the size.

Two potential issues with NSMenuFX that I'm aware of:

  1. Its use of com.sun classes ("Glass") -- this has not been an issue for me and as I recall they have a long-term strategy that meshes with plans for JavaFX upstream, but I'm really not that knowledgeable about JavaFX at this level.
  2. It's been a little tricky (for me, at least) to structure an app so that it uses NSMenuFX on the Mac, but falls back to Windows/Linux menu behavior otherwise. It's not hard to do, but I'd like the code to be a little cleaner. Ideally this should be handled by a framework (e.g. GroovyFX or Griffon) or JavaFX itself. See: Document how to fall back to normal Java/Win/Linux menus codecentric/NSMenuFX#13 and Add a sample App with Standard Mac menus codecentric/NSMenuFX#6.

@msgilligan
Copy link
Contributor Author

msgilligan commented Jul 14, 2018

So, if you're willing to try to integrate NSMenuFX (or another solution, if there is one) into this app, I'm willing to make a PR and take a lead role in making sure it works well on macOS. And, potentially, the solution could migrate upstream to Griffon once we have the issues worked out and decent reference app.

In fact, when GroovyConsoleFX is finished, I'd be up for helping get it into the macOS store.

@msgilligan
Copy link
Contributor Author

msgilligan commented Jul 29, 2018

I just noticed b21893c -- nice work @aalmiray!

I gave it a quick build and test run on my Mac and it seems to be working. The app menu still says java because (IIRC) you need a bundle these days to get the application menu name set.

Which reminds me -- what are your plans for bundling? Do you want to try to build bundled versions? (I can create a separate issue for that if you like)

@aalmiray
Copy link
Owner

There's the matter of not including the Quit menu item under File and rerouting all default menus (Quit, Preferences, About) to the ConsoleController.

I'd like to build several distros:

  • native bundles via the javafx/jpackager plugin.
  • executable fat JAR.

@msgilligan
Copy link
Contributor Author

So for native bundles will we be using JDK 11? It's also interesting to think about how one could make the Groovy version configurable within a native bundled app...

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

2 participants