From b6fcdb83a855d5833c87faf2cb4604e98a1b0e4a Mon Sep 17 00:00:00 2001 From: Amilton de Camargo Jr Date: Fri, 6 Jan 2023 19:29:03 -0300 Subject: [PATCH] Hide Python Launcher icon from MacOS dock --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 7bacfb48..7a6cfc7c 100644 --- a/main.py +++ b/main.py @@ -148,5 +148,12 @@ def on_exit_tray(tray_icon, item): scheduler.QueueHandler() if tray_icon and platform.system() == "Darwin": + from AppKit import NSBundle, NSApp, NSAutoreleasePool, NSApplicationActivationPolicyRegular, NSApplicationActivationPolicyProhibited + + # Hide Python Launcher icon from MacOS dock + info = NSBundle.mainBundle().infoDictionary() + info["LSUIElement"] = "1" + NSApp.setActivationPolicy_(NSApplicationActivationPolicyProhibited) + # For macOS: display the tray icon now with blocking function tray_icon.run()