Removing mirroring and input source options from the menubar

mopre
New Contributor

Looking to cleanup the menubar on deployments and I'd like to have a 'Run once' policy that removes the screen mirroring and input sources icons from the menubar.

I believe the menu item exists in'/System/Library/CoreServices/Menu Extras/Displays.menu' as I can run:

open /System/Library/CoreServices/Menu Extras/Displays.menu

Which adds the icon to the menubar, but I have not found a solution that would allow me to effectively uncheck the display option 'Show mirroring options in the menu bar when available' under Display Settings. Also looking to uncheck the option 'Show input menu in menu bar' located in Keyboard>Input sources.

2 REPLIES 2

mm2270
Legendary Contributor III

This can be done. Here are the steps. So you know, I just did these steps as an experiment to see if it would work and it did.

So the setting that controls if the mirroring options show in the Displays menu is located in the ~/Library/Preferences/com.apple.airplay.plist and the specific setting is called showInMenuBarIfPresent which is a boolean value. Setting it to false removes the mirroring option, which is equivalent to unchecking that box.

How I found this was by using Composer to capture the plist that got modified when disabling/enabling that option.

So this setting can be used in a Configuration Profile with the following steps.

Write the setting into a new plist, to someplace like the Desktop or another location.

defaults write ~/Desktop/com.apple.airplay.plist showInMenuBarIfPresent -bool false

Now convert it to an xml format so Jamf can import it:

plutil -convert xml1 ~/Desktop/com.apple.airplay.plist

Next, in Jamf Pro, create a new Configuration Profile, or edit an existing one if you think it makes sense to bundle it with other options (I would personally keep it separate)
Add the Application & Custom Settings payload to the profile. Choose the Upload a File option and select the plist you created in the above steps.
The profile can be set at Computer Level. It does not need to be User Level to work. Once it's imported, scope to a test machine and deploy. As soon as the profile hits the device, if Airplay mirroring is enabled (showing in the menubar), it will vanish.
If you now open System Preferences > Displays, you can check/enable the mirroring option, but the item will not appear in the menubar icon. If you close and reopen System Preferences, the checkbox will be unchecked again. So it won't stick if you try to enable it, i.e. it's locked out from being changed by the end user.

I tested this successfully on 10.15.7. I didn't try it on Big Sur beta, so I can't speak for that version.

Hopefully that helps you get this set up.

thta
New Contributor III

@mm2270 wrote:

This can be done. Here are the steps. So you know, I just did these steps as an experiment to see if it would work and it did.

So the setting that controls if the mirroring options show in the Displays menu is located in the ~/Library/Preferences/com.apple.airplay.plist and the specific setting is called showInMenuBarIfPresent which is a boolean value. Setting it to false removes the mirroring option, which is equivalent to unchecking that box.

How I found this was by using Composer to capture the plist that got modified when disabling/enabling that option.

So this setting can be used in a Configuration Profile with the following steps.

Write the setting into a new plist, to someplace like the Desktop or another location.

defaults write ~/Desktop/com.apple.airplay.plist showInMenuBarIfPresent -bool false

Now convert it to an xml format so Jamf can import it:

plutil -convert xml1 ~/Desktop/com.apple.airplay.plist

Next, in Jamf Pro, create a new Configuration Profile, or edit an existing one if you think it makes sense to bundle it with other options (I would personally keep it separate)
Add the Application & Custom Settings payload to the profile. Choose the Upload a File option and select the plist you created in the above steps.
The profile can be set at Computer Level. It does not need to be User Level to work. Once it's imported, scope to a test machine and deploy. As soon as the profile hits the device, if Airplay mirroring is enabled (showing in the menubar), it will vanish.
If you now open System Preferences > Displays, you can check/enable the mirroring option, but the item will not appear in the menubar icon. If you close and reopen System Preferences, the checkbox will be unchecked again. So it won't stick if you try to enable it, i.e. it's locked out from being changed by the end user.

I tested this successfully on 10.15.7. I didn't try it on Big Sur beta, so I can't speak for that version.

Hopefully that helps you get this set up.


Thank you! 

Just wish i found this 1 hour ago. 
Works perfectly if you want to enable screen mirroring

 

defaults write ~/Desktop/com.apple.airplay.plist showInMenuBarIfPresent -bool false