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

macOS window represented filename #192

Closed
mworzala opened this issue Feb 2, 2022 · 5 comments · Fixed by #208
Closed

macOS window represented filename #192

mworzala opened this issue Feb 2, 2022 · 5 comments · Fixed by #208

Comments

@mworzala
Copy link
Contributor

mworzala commented Feb 2, 2022

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
Copy link
Collaborator

tonsky commented Feb 3, 2022

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

@mworzala
Copy link
Contributor Author

mworzala commented Feb 3, 2022

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
Copy link
Collaborator

tonsky commented Feb 7, 2022

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
Copy link
Contributor Author

mworzala commented Feb 8, 2022

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
Copy link
Collaborator

tonsky commented Feb 9, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants