how to get Dock.app orientation
// get dock prefs bool bDockAutohide; int nDockSize; char cDockOrientation; { CFStringRef dockAppID = CFSTR("com.apple.dock"); CFStringRef dockAutohideKey = CFSTR("autohide"); CFStringRef dockOrientationKey = CFSTR("orientation"); CFStringRef dockTilesizeKey = CFSTR("tilesize"); Boolean bKeyExist; bDockAutohide = CFPreferencesGetAppBooleanValue(dockAutohideKey, dockAppID, &bKeyExist); if(!bKeyExist) { printf("dock pref key 'autohide' doesn't exist\n"); } printf("dock autohide: %d\n", bDockAutohide); CFPropertyListRef refOrientation = CFPreferencesCopyAppValue(dockOrientationKey, dockAppID); if(refOrientation != NULL) { cDockOrientation = *CFStringGetCStringPtr((CFStringRef)refOrientation, kCFStringEncodingMacRoman); CFRelease(refOrientation); } printf("dock orientation: %c\n", cDockOrientation); CFPropertyListRef refTilesize = CFPreferencesCopyAppValue(dockTilesizeKey, dockAppID); if(refTilesize != NULL) { CFNumberGetValue((CFNumberRef)refTilesize, kCFNumberSInt32Type, &nDockSize); CFRelease(refTilesize); nDockSize += 10; // for paddings } printf("dock size: %d\n", nDockSize); }
plist読むだけでした。nDockSize += 10するのがミソ。