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: add Window>Show UTM menu option #5908

Closed
wants to merge 11 commits into from

Conversation

garamb1
Copy link
Contributor

@garamb1 garamb1 commented Nov 18, 2023

As mentioned in issue #5898, I also noticed there is no way of getting only the virtual machine list window to open if:

  • UTM is running one of more virtual machines
  • The virtual machine list is closed
  • The menu bar icon & menu are disabled (hence the user cannot use CMD + 0 or click on Show UTM from the menu)

This PR adds the option in the Window Menu to show UTM, also adding the CMD + Alt + L keyboard shortcut to do so.

The main window is shown by sending a new notification, handled in the macOS homeWindow View. I am not sure whether this would be the best way of doing so with SwiftUI, so any suggestions are welcome! Thanks for the amazing app!

@osy osy added this to the v4.5 milestone Feb 26, 2024
@garamb1 garamb1 force-pushed the show-main-window-macos branch from 92097e9 to ef97098 Compare February 27, 2024 18:01
@garamb1
Copy link
Contributor Author

garamb1 commented Feb 27, 2024

@osy thanks for adding this to the next release!
I had to cherry pick my original commit and merge the changes from main, it should be ok now.

@@ -32,6 +32,9 @@ struct UTMApp: App {
data.showErrorAlert(message: message)
}
}
.onReceive(NSNotification.ShowMainWindow) { _ in
NSApplication.shared.windows.first?.makeKeyAndOrderFront(nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is good enough. I might play around with it but thinking of capturing a reference in the AppDelegate in order to reference it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks!

@osy
Copy link
Contributor

osy commented Apr 30, 2024

I just realized there is already an option to show the main window:
image

Also, I don't understand this:

The menu bar icon & menu are disabled

image

When you disable the dock icon, the menu icon is forced to be enabled.

@garamb1
Copy link
Contributor Author

garamb1 commented May 8, 2024

I think that was the case on previous releases before the introduction of UTM Server in the Windows menu, see screenshot for reference:
image

As the issue is gone now, closing the PR.
Thank you @osy

@garamb1 garamb1 closed this May 8, 2024
@osy
Copy link
Contributor

osy commented May 8, 2024

Ah I see, that's a weird coincidence lol.

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