HumbleUI/JWM

macOS window represented filename

mworzala opened this issue · 5 comments

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.

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

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.

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

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.

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