Created
May 4, 2019 11:02
-
-
Save hechen/991c624945828458e9b219164d4fac7d to your computer and use it in GitHub Desktop.
toggle cocoa App dockless on or off
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func toggleDock(show: Bool) -> Bool { | |
// ProcessApplicationTransformState | |
let transformState = show ? | |
// show to foreground application | |
// or not show to background application | |
ProcessApplicationTransformState(kProcessTransformToForegroundApplication) | |
: ProcessApplicationTransformState(kProcessTransformToUIElementApplication) | |
// transform current application type. | |
var psn = ProcessSerialNumber(highLongOfPSN: 0, lowLongOfPSN: UInt32(kCurrentProcess)) | |
return TransformProcessType(&psn, transformState) == 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment