Skip to content

fix(apple): Enforce single Firezone instance - #10313

Merged
klochowicz merged 4 commits into
mainfrom
fix/enforce-single-instance-on-macos
Sep 10, 2025
Merged

klochowicz merged 4 commits into
mainfrom
fix/enforce-single-instance-on-macos

Conversation

@klochowicz

@klochowicz klochowicz commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

show an alert to the user and ask to quit previous Firezone instance manually before starting a new one.

Resolves: #10295

@klochowicz klochowicz self-assigned this Sep 9, 2025
@vercel

vercel Bot commented Sep 9, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
firezone Ready Ready Preview Comment Sep 10, 2025 1:40am

@klochowicz

Copy link
Copy Markdown
Contributor Author

Fixes #10295

I don't have Intune, but works when trying to run from XCode at the same time:

Screenshot 2025-09-09 at 14 24 54

@klochowicz

Copy link
Copy Markdown
Contributor Author

note: to gracefully handle this automatically, we could dive deeper into this and listen on old instances for a message sent from a new instance, so it can quit reliably. This approach would require rolling out a new client version to all the customers, and this would probably still be needed as a fallback for when old instance would be too old to handle the message....

@thomaseizinger

Copy link
Copy Markdown
Member

note: to gracefully handle this automatically, we could dive deeper into this and listen on old instances for a message sent from a new instance, so it can quit reliably. This approach would require rolling out a new client version to all the customers, and this would probably still be needed as a fallback for when old instance would be too old to handle the message....

That is what we do on Linux and Windows, we actually make the application visible instead of starting another instance. But the GUI there works slightly differently, also in terms of its design 😅

@jamilbk jamilbk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, just some nitpicky suggestion on language.

Comment thread swift/apple/Firezone/Application/FirezoneApp.swift Outdated
Comment thread swift/apple/Firezone/Application/FirezoneApp.swift Outdated
@jamilbk

jamilbk commented Sep 9, 2025

Copy link
Copy Markdown
Member

Reminder to update the changelog: https://github.com/firezone/firezone/blob/main/website/src/components/Changelog/Apple.tsx

// If we still can't terminate, show an alert to the user
DispatchQueue.main.async {
let alert = NSAlert()
alert.messageText = "Another Firezone Instance Detected"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
alert.messageText = "Another Firezone Instance Detected"
alert.messageText = "Firezone is already running"

Maybe that sounds a bit better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, we're already say that "Another instance is already running" just below it... and I like the uppercase & sounding serious with "detected" :)

I guess we can always iterate on it further if it's unclear to any of our users.

@thomaseizinger thomaseizinger left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM modulo not trying to terminate the old instance and an update of the PR description to match the implemented functionality.

@jamilbk

jamilbk commented Sep 10, 2025

Copy link
Copy Markdown
Member

We show a "Welcome to Firezone" dialog if the app is launched twice (in the case where it's detected properly). Can we make sure this still works?

That was added due to feedback from users since the menu bar icon won't be visible if the menu bar has many things running or the user is on a small screen.

@jamilbk

jamilbk commented Sep 10, 2025

Copy link
Copy Markdown
Member

We show a "Welcome to Firezone" dialog if the app is launched twice (in the case where it's detected properly). Can we make sure this still works?

That was added due to feedback from users since the menu bar icon won't be visible if the menu bar has many things running or the user is on a small screen.

On this note, a minor UX improvement might be to just offer a second button "Quit it and continue" which avoids the user having to use the menu bar at all.

@klochowicz

Copy link
Copy Markdown
Contributor Author

We show a "Welcome to Firezone" dialog if the app is launched twice (in the case where it's detected properly). Can we make sure this still works?

That was added due to feedback from users since the menu bar icon won't be visible if the menu bar has many things running or the user is on a small screen.

yes, it still works. just checked locally.

klochowicz and others added 4 commits September 10, 2025 11:08
Try to terminate the old instance; if it fails, show an alert to the
user and ask to quit it manually before starting a new one.
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
Signed-off-by: Mariusz Klochowicz <mariusz@klochowicz.com>
@klochowicz
klochowicz force-pushed the fix/enforce-single-instance-on-macos branch from cca7b1e to 986f24f Compare September 10, 2025 01:38
@klochowicz
klochowicz added this pull request to the merge queue Sep 10, 2025
Merged via the queue into main with commit 963cc8e Sep 10, 2025
28 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 20, 2025

This branch was successfully deployed

1 active deployment
Preview — 986f24fc Deployed Sep 10, 2025 by vercel[bot]
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.

Prevent two instances of macOS app from running

3 participants