I am trying to hide the dock, and menu/spotlight bar at the top of the screen and basically go into kiosk mode for my Cocoa OS X app. However, I don't want to activate full-screen mode. I want the app to run as normal, but simply hide the dock and the menu/spotlight area on the desktop to discourage users from using them. I have tried a variety of options and I can't seem to get it to work.
https://developer.apple.com/library/mac/technotes/KioskMode/Introduction/Introduction.html
It seems like most implementations of this code require going into full-screen or are in Objective C. Is there a way of doing this in Swift without going into Full-screen mode?
Update - I figured out how to do it! I could hide the menu using NSMenu but I had to hide the dock by accessing the terminal. There may be an easier and cleaner way of doing it, but I was unable to find one. I hope this helps anyone else looking for a solution!
import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var datastring = NSString() func applicationDidFinishLaunching(aNotification: NSNotification) { let task = NSTask() let pipe = NSPipe() task.standardOutput = pipe task.launchPath = "/bin/bash/" task.arguments = ["defaults write com.apple.dock tilesize -int 1", "killall -Kill Dock"] let file:NSFileHandle = pipe.fileHandleForReading task.launch() task.waitUntilExit() let data = file.readDataToEndOfFile() datastring = NSString(data: data, encoding: NSUTF8StringEncoding)! // Insert code here to initialize your application } func applicationWillTerminate(aNotification: NSNotification) { // Insert code here to tear down your application } override func awakeFromNib() { NSMenu.setMenuBarVisible(false) } } }