diff options
author | der richter <der.richter@gmx.de> | 2020-09-15 16:44:12 +0200 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2020-09-20 15:28:50 +0200 |
commit | 03047a0169495c3323ecbaf1c7ea8029c082dc2e (patch) | |
tree | ceb6c001c8de057f4845dab52941adf2ff6e9bf4 /video/out | |
parent | e28724d90d9d62c01c13d7da8ff2f10b490fc8ae (diff) | |
download | mpv-03047a0169495c3323ecbaf1c7ea8029c082dc2e.tar.bz2 mpv-03047a0169495c3323ecbaf1c7ea8029c082dc2e.tar.xz |
mac: add an option to change the App activation policy
useful to hide the app icon in the Dock if necessary.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/mac/common.swift | 19 |
1 files changed, 18 insertions, 1 deletions
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() } |