HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
547 stars 44 forks source link

macOS window represented filename #192

Closed mworzala closed 2 years ago

mworzala commented 2 years ago

See https://www.electronjs.org/docs/latest/tutorial/represented-file

My proposition for an API is WindowMac#setRepresentedFilename(String filename, boolean iconOnly). There is an option to let the window determine an appropriate name based on the file (just the filename as far as I can tell), otherwise it just sets the icon and allows expanding the dropdown.

tonsky commented 2 years ago

What does iconOnly corresponds to? We’ll probably also need getRepresentedFilename

mworzala commented 2 years ago

iconOnly=true

Screen Shot 2022-02-03 at 4 11 42 PM

iconOnly=false

Screen Shot 2022-02-03 at 4 12 15 PM

It's certainly optional since the user could just set the title themselves. I have not found anything on how it chooses a title, it may always just be the filename.

Good point on a getter.

tonsky commented 2 years ago

So this file name is no different than setting title manually? Is there a corresponding API in AppKit that has iconOnly flag or it will be a custom implementation?

Right now it feels like setRepresentedFilename should only set the icon but not the filename, and the filename could come from setTitle

mworzala commented 2 years ago

There is both setRepresentedFilename and setTitleWithRepresentedFilename. The description from the docs for what the title is set to is

Sets a given path as the window’s title, formatting it as a file-system path

I am not sure if there is any case it is not simply the file name or whether that case is important.

tonsky commented 2 years ago

I think WindowMac#setRepresentedFilename(String filename) would be enough