Puede activarlo y desactivarlo manualmente en las preferencias del sistema de notificaciones.
Actualizaraestarespuesta:
EstofuncionabastantebienenmiMac.Peronoestálocalizadoyesrealmenteunscriptrápidoelaboradocomounapruebadeconcepto...(esoeseldescargoderesponsabilidad)
LaideaescolocarestescriptenelmenúApplescriptyejecutarlocuandoquierascambiarelreproductordeiTunesdeMainalminiplayer.
Lasecuenciadecomandosharáelcambioporti,verificaquéventanaestáactivayluegoabrelaspreferenciasdelsistema.IntentaencontrarlasnotificacionesdeiTunesycambiaa"Ninguna" o "Banners" según sea necesario. He ignorado completamente las "Alertas" en esto porque estoy seguro de que la mayoría de las personas no tendrían eso seleccionado.
property delayTimeMax : 2
property windowTitle : ""
set windowTitle to ""
property delayCounter : 0
set delayCounter to 0
property theList : ""
tell application "System Events"
tell application "iTunes" to activate
delay 1
keystroke "m" using {command down, shift down} --//Toggle the itunes window
my windowTheTitle() --//-- try and get the window title
end tell
tell application "System Events"
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
set delayCounter to 0
my openSystemEvents() --//-- try and open the system prefs window
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
set delayCounter to 0
tell application process "System Preferences"
set this_item to ""
my findTable() --//-- try and find the app list in the system prefs window
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
set delayCounter to 0
set counter to 0 --// the counter will increment for each row that represents an app
--// find the correct one using it's static text which will be the app name
repeat with i from 1 to number of items in theList
set this_item to item i of theList
set counter to counter + 1
try
set theValue to value of static text of this_item
end try
if item 1 of theValue is equal to "iTunes" then
exit repeat --// found it exit repeat
end if
end repeat
select row counter of table 1 of scroll area 1 of window "Notifications" --// select the app in the table
set theRadiaGroup to radio group 1 of group 1 of window "Notifications" --// the Radio buttons for the Notification type
if windowTitle is "MiniPlayer" then
--// mini player is active
set theVal to value of radio button "None" of radio group 1 of group 1 of window "Notifications"
--// we do not want to click the button if it is already selected. Which may or may not deslect all of them. (poss bug)
if theVal is 0 then
--//select no alert
click radio button "None" of radio group 1 of group 1 of window "Notifications"
end if
else
--// MAIN window is active
set theVal to value of radio button "Banners" of radio group 1 of group 1 of window "Notifications"
if theVal is 0 then
--// we do not want to click the button if it is already selected. Which may or may not deslect all of them. (poss bug)
click radio button "Banners" of radio group 1 of group 1 of window "Notifications"
end if
end if
end tell
end tell
tell application "System Preferences" to quit
on windowTheTitle()
tell application "System Events"
try
tell application process "iTunes" to set windowTitle to get title of window 1 --//Get the window title : iTunes or MiniPlayer
on error
set delayCounter to delayCounter + 1
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
delay 1
my windowTheTitle()
end try
end tell
end windowTheTitle
on openSystemEvents()
tell application "System Events"
try
tell application "System Preferences"
activate
delay 1
set the current pane to pane id "com.apple.preference.notifications" --// Open System Events at the notifications prefs
if id of current pane is not "com.apple.preference.notifications" then
set delayCounter to delayCounter + 1
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
delay 1
my openSystemEvents()
end if
end tell
on error
set delayCounter to delayCounter + 1
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
delay 1
my openSystemEvents()
end try
end tell
end openSystemEvents
on findTable()
tell application "System Events"
try
tell application process "System Preferences"
set theList to (get group 1 of UI element 1 of every row of table 1 of scroll area 1 of window "Notifications") -- get all the radio groups : the Apps grouped icon and text it the table
end tell
on error
set delayCounter to delayCounter + 1
if delayCounter > delayTimeMax then return --//-- too many trys, lets stop
delay 1
my findTable()
end try
end tell
end findTable
Como dije prueba de concepto. Lo más probable es que puedas ponerlo en un Servicio de Automatización y usar una tecla de acceso rápido con él.
También tenga en cuenta: dependiendo de su sistema, es posible que deba agregar más demoras para esperar a que la interfaz de usuario se ponga al día
Actualización 2
Funciona mejor en realidad como un servicio de Automator con una tecla de acceso directo.
En Automator, use una acción Ejecutar en AppleScript y reemplace el código de su plantilla con el anterior.
Establezca la entrada en no. y cualquier aplicación. Guárdalo.
Abre las preferencias de acceso directo. Encuentre su servicio en los Servicios y agregue un acceso directo.
hecho.