Puoi accenderlo e spegnerlo manualmente nelle preferenze Sistema di notifiche.
Aggiorna a questa risposta:
Funziona abbastanza bene sul mio Mac. Ma non è localizzato ed è davvero uno script veloce messo insieme come una prova del concetto .. (questo è il disclaimer)
L'idea è di inserire questo script nel menu Applescript ed eseguirlo quando si desidera passare da iTunes al lettore principale da mini player.
Lo script eseguirà la commutazione per te, controlla quale finestra è attiva e quindi apri le preferenze di sistema, prova a trovare le notifiche di iTunes e passa a "Nessuno" o "Banner" a seconda. Ho completamente ignorato "Avvisi" in questo perché sono sicuro che molte persone non lo avrebbero selezionato !.
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
Come ho detto, prova del concetto. Molto probabilmente è possibile inserirlo in un servizio di automazione e utilizzare un tasto di scelta rapida con esso.
Nota anche: a seconda del sistema potrebbe essere necessario aggiungere più ritardi per attendere il recupero dell'interfaccia utente
Aggiornamento 2
Funziona meglio in realtà come servizio di automazione con un tasto di scelta rapida.
In Automator usa Run Eslescript Action e sostituisci il suo codice modello con il precedente.
Impostare l'ingresso su non. e qualsiasi applicazione. Salvarla.
Apri le preferenze di collegamento. Trova il tuo servizio in Servizi e aggiungi un collegamento.
fatto.