Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:46:21+00:00 2026-05-27T17:46:21+00:00

For my Mac OSX application, I have a feature that removes the system clock

  • 0

For my Mac OSX application, I have a feature that removes the system clock in the upper right hand corner of the screen when a button is clicked. The preferences that control which system menus are displayed (including the system clock) is stored in ~/Library/Preferences/com.apple.systemuiserver.plist. I was able to update the relevant preferences in that file to remove the system clock. However, the SystemUIServer application needs to be restarted so that the new preferences can be reloaded and the clock can be removed. Here is the code I have used to restart SystemUIServer.

NSTask *killSystemUITask = [[NSTask alloc] init];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"SystemUIServer"];
[killSystemUITask setLaunchPath:@"/usr/bin/killall"];
[killSystemUITask setArguments:args];
[killSystemUITask launch];

When SystemUIServer is killed, OSX automatically restarts it. The above code works, but the removal of the system clock is not as clean as I would like. The entire system bar is removed for a second. Can anyone think of a better way to reload the preferences into SystemUIServer? Ideally, I’d like the removal of the system clock to be as clean as the clock display function in the Date & Time Preferences of the System Preferences application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:46:21+00:00Added an answer on May 27, 2026 at 5:46 pm

    Have you considered trying to drive the pref pane itself using AppleEvents/OSAScript? While the Network prefs pane seems to be the only one with fully built-out scriptability, you can drive any UI with System Events. It was easy enough to prototype in AppleScript. Here’s 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 either use it as is by using an NSAppleScript object, or if you’re feeling masochistic, you can dive in to the minutia of figuring out just the right AppleEvents to send. (I recommend the former approach for sanity, but the latter will execute faster at runtime.)

    Pros: Easy.

    Cons: Launches System Preferences (which can be seen to be bouncing in the Dock), Requires “Enable Access for assistive devices” to be enabled (like many other things)

    Hard to say if this is visually better or worse that killing SystemUIServer, but it’s almost certainly kinder to any other components that might be interacting with SystemUIServer.

    As far as getting rid of the dock bounce, this question over here mentions how to get things to start up without a dock icon. To this I can add that in the past, I’ve wrangled with this problem, and the solution I came up with was, at a high level, this:

    • Get a unique/safe temp directory
    • Make a hard-links only mirror of the entire bundle of the app in question (pax -rwl will help with this)
    • Replace the hard-linked Info.plist with a real copy of Info.plist
    • Edit the copy per the directions in the other question. (Note: There are other options than setting NSUIElement = true here, but I leave those as an exercise for the reader and google.)
    • Use the application from the temp directory
    • Delete the temp directory.

    This approach has proven quite robust for me when trying to drive 3rd party applications. I’m guessing that you might, in the future, run into problems with system applications which are signed/sandboxed. (i.e. changing their Info.plist changes the signature, they may refuse to run.) Also, naturally, any sandboxed app will require a specific entitlement or exception to send AppleEvents at all, but I would guess this is also true of killing system processes (if that’s even possible to do from a sandboxed app at all.)

    Lastly, you should file a bug report with Apple requesting first-class API or scriptability for this if you feel it’s important.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have previously written an application for Mac OSX that includes a kernel extension.
I have a relatively simple application which I need to make native Mac OSX
I have an application for Mac OS X that supports plugins that are intended
I'm building a utility application that synchronizes files across two systems for Mac OSX.
I have created a Mac OS X helper application that always runs under root.
I have a windows command-line application which must be executed in Mac OSX Lion.
I have to migrate a iPhone application to Mac OSx. Anybody knows where I
I have a Java Swing application, developed on Mac OS X 10.5 using Java
I'm looking to develop a small application on Mac OSX and it will need
In a wxPython application, which i am porting to Mac OSX, I set title

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.