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

Handle dock icon click to open Tunnel Manager (applicationShouldHandleReopen) #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luckman212
Copy link

One thing that bugs me about the WireGuard macOS app is that clicking on its Dock icon does not open the Tunnel Manager window. This is non macOS-like, and limits the ability to show that window programatically via shell scripts, AppleScript, JXA, Alfred etc.

My poor-man's kludge to automate this is to literally quit the app and re-open it, like this (JXA):

function run(argv) {
  var WG = new Application("WireGuard");
  WG.quit();
  WG.activate();
  return;
}

...but that's embarrassingly inefficient. I believe after looking at the code that it's because there's no applicationShouldHandleReopen() func handler.

So this is not a full working PR, just a bit of starter code I was hoping to get refined into a working fix. I do believe the fix is small and fairly easy to implement.

References:

@luckman212
Copy link
Author

Unfortunately I can't even build this to test it myself since I don't have a paid Developer account, and without that Apple deems me unfit to produce a Network Extension.

image

Any thoughts from anyone else?

@luckman212
Copy link
Author

Now that macOS development has somewhat resumed, wondering if anyone has some thoughts on this one?

sebastianlivoni added a commit to sebastianlivoni/wireguard-apple that referenced this pull request Jul 1, 2023
@sebastianlivoni
Copy link

sebastianlivoni commented Jul 1, 2023

I've just added a commit removing the "?". It works as expected by opening the Tunnel Manager when reopened.

@luckman212
Copy link
Author

luckman212 commented Jul 1, 2023

@sebastianlivoni Nice. Does it build "as-is" using Xcode14? I haven't tried recently, but when I tried some months ago I didn't have a Developer license (I do now) so I couldn't build the NetworkExtension...

@sebastianlivoni
Copy link

sebastianlivoni commented Jul 1, 2023

Yep, it does built "as-is". I just had to add the following PATH to "Build Settings" because I'm using M1:

PATH = ${PATH}:/opt/homebrew/opt/[email protected]/bin

@luckman212
Copy link
Author

@zx2c4 or @protonjohn Any chance of this fix making it to the AppStore version?

@luckman212
Copy link
Author

Or maybe @alessionossa could take a peek?

@alessionossa
Copy link

Or maybe @alessionossa could take a peek?

I could take a look at it, but I have no rights on this repository to merge it and create and App Store version. Also, GitHub is just a mirror for https://git.zx2c4.com/wireguard-apple, so you should contact the developer push changes there in order to contribute.

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.

3 participants