开发者

Hide the dock programmatically on Mac OS X

开发者 https://www.devze.com 2023-04-12 21:26 出处:网络
I am working on a new software for Mac OS X Snow Leopard, and one of the features I need to 开发者_开发百科implement is when my application starts, hide the Dock completely and block Spotlight from wo

I am working on a new software for Mac OS X Snow Leopard, and one of the features I need to 开发者_开发百科implement is when my application starts, hide the Dock completely and block Spotlight from working while the application is running. Anyone knows if this is possible and how to do it?


I agree with comment - "don't be evil".

And considering you won't be evil, this can be your solution.


try this, not sure about spotlight, but this has the dock and menu bar hiding.


Use OS X Kiosk Mode

https://developer.apple.com/library/mac/technotes/KioskMode/Introduction/Introduction.html

Use the bitmask NSApplicationPresentationOptions to enable the Kiosk Mode options you would like to use.

For your specific request, "hide the Dock completely and block Spotlight from working while the application is running."

NSApplicationPresentationHideDock

Dock is entirely unavailable. Spotlight menu is disabled.

- (void)awakeFromNib {
     @try {
          NSApplicationPresentationOptions options = NSApplicationPresentationHideDock;
          [NSApp setPresentationOptions:options];
     }
     @catch(NSException * exception) {
          NSLog(@"Error. Make sure you have a valid combination of options.");
     }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号