Spotlight Customization

Jason
Contributor II

Has anyone been able to select/deselect categories under System Preferences > Spotlight with the JSS?

I know that ~/Library/Preferences/com.apple.spotlight.plist gets modified when a category is manually changed in the GUI. But if i change it directly in the plist nothing seems to update in the GUI. I've tried relaunching the Agent/Daemon but without luck:

launchctl unload -w /System/Library/LaunchAgents/com.apple.Spotlight.plist
launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
launchctl load -w /System/Library/LaunchAgents/com.apple.Spotlight.plist
launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Has anyone been able to set this with a Configuration Profile or Policy? I've seen this done with a package (https://jamfnation.jamfsoftware.com/discussion.html?id=13235) but am curious if there is a non-packaged option.

2 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor III

Have you tried running a killall cfprefsd after making the changes? That seems to work for me. Remember that starting with 10.9 and up, OS X has more aggressive preference caching, so it often doesn't let go of its cached settings without forcing the issue.

Keep in mind the killall command should be run in the user context, not as root, since the Spotlight preferences are user specific.

As a side note. I see that the orderedItems array doesn't actually exist in the plist by default. It isn't created until you disable one of the items in the Spotlight Search Results preference tab. Until then, trying to read back that array fails since its not present in the plist.

View solution in original post

davidacland
Honored Contributor II
Honored Contributor II

What are you using to edit the plist file? defaults is preference caching aware but I have still had issues.

+1 for killall cfprefsd

In some cases I've had to log the user out and back to get a setting change to apply, in extreme cases (some of the localization settings) a full restart.

I would try setting it how you want and using mcxtoprofile with the once option to turn it into a config profile.

View solution in original post

4 REPLIES 4

mm2270
Legendary Contributor III

Have you tried running a killall cfprefsd after making the changes? That seems to work for me. Remember that starting with 10.9 and up, OS X has more aggressive preference caching, so it often doesn't let go of its cached settings without forcing the issue.

Keep in mind the killall command should be run in the user context, not as root, since the Spotlight preferences are user specific.

As a side note. I see that the orderedItems array doesn't actually exist in the plist by default. It isn't created until you disable one of the items in the Spotlight Search Results preference tab. Until then, trying to read back that array fails since its not present in the plist.

davidacland
Honored Contributor II
Honored Contributor II

What are you using to edit the plist file? defaults is preference caching aware but I have still had issues.

+1 for killall cfprefsd

In some cases I've had to log the user out and back to get a setting change to apply, in extreme cases (some of the localization settings) a full restart.

I would try setting it how you want and using mcxtoprofile with the once option to turn it into a config profile.

Jason
Contributor II

Yep, you guys nailed it. killall cfprefsd did the trick.

rbrugos
New Contributor

Hello, this is very interesting. May ask how to resize the Spotlight window so every time it opens bigger that the default window. I am looking at the com.apple.Spotlight.plist file in the preferences folder and this is the text I get:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>GEOUsageSessionID</key> <data> CKjNnPeujrCh5AEQmNn0us/Mn6XyAQ== </data> <key>GEOUsageSessionIDGenerationTime</key> <real>514515119.99934697</real> <key>NSAllowsDefaultLineBreakStrategy</key> <true/> <key>NSStatusItem Preferred Position Item-0</key> <real>64</real> <key>SPLoggingWindowHideCount</key> <integer>7103</integer> <key>SPLoggingWindowShowCount</key> <integer>7127</integer> <key>Storefront</key> <string>143501-28,32</string> <key>__NSEnableTSMDocumentWindowLevel</key> <true/> <key>engagementCount-com.apple.Mail</key> <integer>0</integer> <key>engagementCount-com.apple.Spotlight</key> <integer>100</integer> <key>lastVisibleScreenRect</key> <string>{{0, 0}, {1280, 777}}</string> <key>lastWindowPosition</key> <string>{{300, 347}, {680, 430}}</string> <key>orderedItems</key> <array> <dict> <key>enabled</key> <true/> <key>name</key> <string>APPLICATIONS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MENU_SPOTLIGHT_SUGGESTIONS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MENU_CONVERSION</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MENU_EXPRESSION</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MENU_DEFINITION</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>SYSTEM_PREFS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>DOCUMENTS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>DIRECTORIES</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>PRESENTATIONS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>SPREADSHEETS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>PDF</string> </dict> <dict> <key>enabled</key> <false/> <key>name</key> <string>MESSAGES</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>CONTACT</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>EVENT_TODO</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>IMAGES</string> </dict> <dict> <key>enabled</key> <false/> <key>name</key> <string>BOOKMARKS</string> </dict> <dict> <key>enabled</key> <false/> <key>name</key> <string>MUSIC</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MOVIES</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>FONTS</string> </dict> <dict> <key>enabled</key> <true/> <key>name</key> <string>MENU_OTHER</string> </dict> </array> <key>showedFTE</key> <true/> <key>startTime</key> <real>525815732.913405</real> <key>useCount</key> <integer>3</integer> <key>userHasMovedWindow</key> <true/> <key>version</key> <integer>7</integer> <key>windowHeight</key> <real>430</real>
</dict>
</plist>

I see, almost at the end of the text:
<key>windowHeight</key> <real>430</real>

Tried adding <key>windowWidth</key> <real>1000</real>

But I see no change.

Any ideas?

Thanks in advance.