'Is it possible to write a script to close a popup on the Mac touchbar?

There is this prompt on the mac touch bar that says "Display Connected: Mirror Displays / Extend Desktop" with a little X on the left hand corner. This prompt pops up every time I wake my macbook up while it is connected to an external display. As far as I know the only way to turn it off is by tapping the X.

Is it possible to write a script to tap the X automatically when I wake up my computer? Or is there a specific plist file that contains the touch bar code that could help me disable that pop up?

example



Solution 1:[1]

Choose Apple menu > System Preferences, click Notifications & Focus , then click Notifications.

Select an app or website on the left, then view or change settings on the right. The options vary by app and OS.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arden Smith