aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-05-20 14:04:47 +0530
committerRoopesh Chander <roop@roopc.net>2019-05-20 16:42:28 +0530
commit40b1f0bac804985d1fceaef9422eb4c5f0ad204e (patch)
tree4308b55c1441dd6a636cb40a050a78710e0abdaf /WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m
parentmacOS: Login item: Get helper app version from xcconfig (diff)
downloadwireguard-apple-40b1f0bac804985d1fceaef9422eb4c5f0ad204e.tar.xz
wireguard-apple-40b1f0bac804985d1fceaef9422eb4c5f0ad204e.zip
macOS: Don't show manage window when launched at login
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m11
1 files changed, 6 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m b/WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m
index 51b73fd..1010b49 100644
--- a/WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m
+++ b/WireGuard/WireGuard/UI/macOS/LoginItemHelper/main.m
@@ -5,12 +5,13 @@
int main(int argc, char *argv[])
{
- NSURL *bundleURL = [NSBundle.mainBundle bundleURL];
+ NSString *appIdInfoDictionaryKey = @"com.wireguard.macos.app_id";
+ NSString *appId = [NSBundle.mainBundle objectForInfoDictionaryKey:appIdInfoDictionaryKey];
- // From <path>/WireGuard.app/Contents/Library/LoginItems/WireGuardLoginItemHelper.app, derive <path>/WireGuard.app
- for (int i = 0; i < 4; ++i)
- bundleURL = [bundleURL URLByDeletingLastPathComponent];
+ NSString *launchCode = @"LaunchedByWireGuardLoginItemHelper";
+ NSAppleEventDescriptor *paramDescriptor = [NSAppleEventDescriptor descriptorWithString:launchCode];
- [NSWorkspace.sharedWorkspace launchApplication:[bundleURL path]];
+ [NSWorkspace.sharedWorkspace launchAppWithBundleIdentifier:appId options:NSWorkspaceLaunchWithoutActivation
+ additionalEventParamDescriptor:paramDescriptor launchIdentifier:NULL];
return 0;
}