summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2020-09-15 16:44:12 +0200
committerder richter <der.richter@gmx.de>2020-09-20 15:28:50 +0200
commit03047a0169495c3323ecbaf1c7ea8029c082dc2e (patch)
treeceb6c001c8de057f4845dab52941adf2ff6e9bf4 /video
parente28724d90d9d62c01c13d7da8ff2f10b490fc8ae (diff)
downloadmpv-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')
-rw-r--r--video/out/mac/common.swift19
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()
}