Posted on β01-17-2022 08:27 PM
Hi,
Our fleet has just jumped from Catalina to Monterey and our users are struggling to locate the screen mirroring "Show in menu Bar" tickbox.
Ideally I would just like a script to enable this or our users.
I have tried
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist ScreenMirroring -int 18
but it doesn't seem to work.
weirdly sound and bluetooth work though which are controlled inside the same plist.
e.g: defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist Sound -int 18
anyone got any ideas how the ScreenMirroring preference can be set via terminal script?
Cheers,
ES
Solved! Go to Solution.
β01-18-2022 09:31 AM - edited β01-18-2022 09:38 AM
@elliots :
I found this in the MacAdmins slack...credit to @nstrauss - noting it's "per user":
#!/bin/zsh
logged_in_user=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name π && ! /loginwindow/ { print $3 }')
user_home=$(dscl . -read /users/$logged_in_user NFSHomeDirectory | cut -d " " -f 2)
sudo -u "$logged_in_user" /usr/bin/defaults write "$user_home"/Library/Preferences/ByHost/com.apple.controlcenter.plist ScreenMirroring -int 18
sudo -u "$logged_in_user" /usr/bin/defaults write "$user_home"/Library/Preferences/com.apple.airplay.plist showInMenuBarIfPresent -bool true
sudo killall "ControlCenter"
Works here in macOS 12.2 beta I'm running, so give it a shot....
Posted on β01-18-2022 02:29 AM
Update:
I have managed to enable the tickbox with:
defaults write com.apple.airplay showInMenuBarIfPresent -bool true
However I have another hurdle. Is it possible to change from the default: "when active" to "always" so it always displays in the menubar?
ES
β01-18-2022 09:31 AM - edited β01-18-2022 09:38 AM
@elliots :
I found this in the MacAdmins slack...credit to @nstrauss - noting it's "per user":
#!/bin/zsh
logged_in_user=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name π && ! /loginwindow/ { print $3 }')
user_home=$(dscl . -read /users/$logged_in_user NFSHomeDirectory | cut -d " " -f 2)
sudo -u "$logged_in_user" /usr/bin/defaults write "$user_home"/Library/Preferences/ByHost/com.apple.controlcenter.plist ScreenMirroring -int 18
sudo -u "$logged_in_user" /usr/bin/defaults write "$user_home"/Library/Preferences/com.apple.airplay.plist showInMenuBarIfPresent -bool true
sudo killall "ControlCenter"
Works here in macOS 12.2 beta I'm running, so give it a shot....
β01-18-2022 09:40 AM - edited β01-18-2022 09:40 AM
Dang it...where the "smiley" is, change to : / (with no space in between)!!!
Someone tell me why pasting into code gives me emojis? Or rather, how do I stop that!
Posted on β01-19-2022 01:35 PM
@scottb Apologies, Scott, this is a bug and we are working to resolve it as quickly as possible. π
Posted on β01-19-2022 02:04 PM
Thank you, @CalleyO - I meant to file it and forgot! Appreciate the heads-up.
Posted on β01-19-2022 04:34 AM
Oh Thankyou! that worked a treat.