From 03047a0169495c3323ecbaf1c7ea8029c082dc2e Mon Sep 17 00:00:00 2001 From: der richter Date: Tue, 15 Sep 2020 16:44:12 +0200 Subject: mac: add an option to change the App activation policy useful to hide the app icon in the Dock if necessary. --- video/out/mac/common.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/out/mac/common.swift b/video/out/mac/common.swift index 4b5e1265c0..fb52b80610 100644 --- a/video/out/mac/common.swift +++ b/video/out/mac/common.swift @@ -61,7 +61,24 @@ class Common: NSObject { } func initApp() { - NSApp.setActivationPolicy(.regular) + guard let mpv = mpv else { + log.sendError("Something went wrong, no MPVHelper was initialized") + exit(1) + } + + var policy: NSApplication.ActivationPolicy = .regular + switch mpv.macOpts.macos_app_activation_policy { + case 0: + policy = .regular + case 1: + policy = .accessory + case 2: + policy = .prohibited + default: + break + } + + NSApp.setActivationPolicy(policy) setAppIcon() } -- cgit v1.2.3