简体   繁体   中英

check whether osx menu bar is translucent?

We can change set Translucent menu bar from System Preferences -> Desktop settings.

Is there a way to read the this setting from some API or plist file and to get notified if user switches from Translucent menu bar settings?

If we do this,

[[NSDistributedNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(dockChanges:)
 name:@"com.apple.dock.prefchanged"
 object:nil];

We can be notified of changes done in system preferences. I am looking for something same?

This is how we can can get the information about menu transparency.

NSDictionary *oldGlobalPreferences = [NSDictionary dictionaryWithContentsOfFile: 
                                              [@"~/Library/Preferences/.GlobalPreferences.plist" 
                                               stringByExpandingTildeInPath]];

bool bIsTransparencyEnabled = [[oldGlobalPreferences objectForKey:@"AppleEnableMenuBarTransparency"] boolValue];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM