Do you consider trying to control your own panel using AppleEvents / OSAScript? Although the Network Prefix panel is apparently the only one with fully integrated scripting capabilities, you can control any user interface using system events. It was easy enough to prototype in AppleScript. Here is what I came up with:
tell application "System Preferences" reveal pane "Date & Time" reveal anchor "ClockPref" of pane "Date & Time" tell application "System Events" tell tab group 1 of window 1 of process "System Preferences" repeat with cbIndex from 0 to count of checkboxes tell checkbox cbIndex if title contains "menu bar" then click exit repeat end if end tell end repeat end tell end tell quit end tell
You can use it as is using the NSAppleScript object, or if you feel masochistic, you can dive into the little things to figure out how to properly send AppleEvents. (I recommend the former approach for sanity, but the latter will run faster at runtime.)
Pros: Easy.
Cons: launches system settings (which, as you can see, bounce in the dock), you need to activate "Enable access for assistive devices" (like many others)
It's hard to say if it is visually better or worse than killing SystemUIServer, but it is almost certainly kind to any other components that can interact with SystemUIServer.
To get rid of the rollback of the dock, this question here mentions how to get things to start without the dock icon. To this I can add that in the past I argued with this problem, and the solution that I came up with was at a high level:
- Get a unique / secure temp directory
- Mirror only links to the entire application suite (
pax -rwl will help with this) - Replace the tightly bound Info.plist with a real copy of Info.plist
- Edit the copy in the directions in another question. (Note: there are other options here than setting
NSUIElement = true , but I leave them as an exercise for the reader and google.) - Use the application from the temp directory
- Delete the temp directory.
This approach turned out to be quite reliable for me when trying to use third-party applications. I assume that in the future you may have problems with system applications that are signed / isolated. (i.e. changing their Info.plist changes the signature, they may refuse to run.) In addition, it is natural that any isolated application will require a certain right or exception to send AppleEvents in general, but I would suggest that this also applies to killing system processes (if at all possible to make an isolated application at all.)
Finally, you should write a bug report to Apple , requesting a top-notch API or scripting for this if you find this important.