MacOS Hide Application / App Physical Memory State
Posted: Sun Sep 18, 2016 1:58 pm
Update v1.02

Code: Select all
;-TOP
; By mk-soft, v1.01.2, Create: 18.09.2016, Update 28.04.2025
; Link: https://www.purebasic.fr/english/viewtopic.php?t=66626
; The following activation policies control whether and how an application may be activated.
; They are determined by the `Info.plist`.
Enumeration NSApplicationActivationPolicy
; The application is an ordinary app that appears in the Dock and may have a user interface.
; This is the Default For bundled apps, unless overridden in the Info.plist.
#NSApplicationActivationPolicyRegular
; The application does not appear in the Dock and does not have a menu bar,
; but it may be activated programmatically Or by clicking on one of its windows.
; This corresponds To LSUIElement=1 in the Info.plist.
#NSApplicationActivationPolicyAccessory
; The application does not appear in the Dock and may not create windows or be activated.
; This corresponds to LSBackgroundOnly=1 in the Info.plist.
; This is also the Default For unbundled executables that do not have Info.plists.
#NSApplicationActivationPolicyProhibited
EndEnumeration
Procedure HideApplication(Window, State)
Protected NSApp
NSApp = CocoaMessage(0, 0, "NSApplication sharedApplication")
If State
CocoaMessage(0, NSApp, "setActivationPolicy:", #NSApplicationActivationPolicyAccessory)
Else
CocoaMessage(0, NSApp, "setActivationPolicy:", #NSApplicationActivationPolicyRegular)
EndIf
HideWindow(Window, State)
EndProcedure
; ****
