Me encontré con el mismo problema hace un tiempo, y esto es lo que hice:
En primer lugar, me reflejo de la muestra, como ya se ha sugerido. Pronto después de esto, me di cuenta de que era una gran distracción para tener el macbook encendido apagado de pantalla en la esquina de mi ojo. Esto requiere que me matan el brillo en el macbook de la pantalla. Pero siendo el perezoso chico que soy, yo odiaba tener que ajustar manualmente el brillo cada vez que un/conectado un monitor externo. Así que me preguntaba si había una manera de automatizar el proceso. He encontrado esta aplicación gratuita llamada Plano de Control que me permite establecer el "contexto" de la base de si ciertos dispositivos (monitores, unidades de disco duro, etc) están conectados, si ciertas redes wi-fi están en el rango, etc; y con base en estos contextos, ejecutar ciertas secuencias de comandos de shell. Así que todo lo que tenía que hacer era escribir un applescript (llamado killBrightness.scpt
) para matar el brillo en el macbook y la pantalla de un script de shell para llamar a killBrightness.scpt
; y llamar a este script de shell en el contexto necesario.
killBrightness.scpt
tell application "System Preferences" to set current pane to pane "Displays"
tell application "System Events"
tell process "System Preferences"
repeat with theWindow in windows
if title of theWindow as string is "Color LCD" then
tell tab group 1 of theWindow
tell slider 1 of group 2
set value to 0
end tell
end tell
end if
end repeat
end tell
end tell
tell application "System Preferences" to quit
La secuencia de comandos de shell
#!/bin/sh
osascript /path/to/killBrightness.scpt
Desde que me conecte muchos diferentes monitores en mi macbook, me di cuenta de que cuando una persona con una relación de aspecto diferente está enchufado, mi windows cuelgue del borde de la pantalla. La solución a esto sería para cambiar el tamaño de las ventanas, pero eso es muy ineficiente cuando se utiliza un montón de aplicaciones y ventanas, al igual que yo; además, yo, por ser tan perezoso como yo, no nos gusta que la solución. Así, con la ayuda de la gente agradable en más de Stack Overflow, yo era capaz de llegar con este AppleScript (llamado resizer.scpt
) automáticamente cambiar el tamaño de todas las ventanas de (casi) todas las aplicaciones (la advertencia es que algunas aplicaciones no el uso correcto del marco de interfaz de usuario ganchos, por lo que es muy difícil cambiar el tamaño de ellos):
resizer.scpt
:
property blacklist : {"Finder", "Preview", "Console", "AppleScript Editor", "Spotify", "TaskCoach", "Skype", "VirtualBox"}
property buttonApps : {"LyX", "Eclipse"}
property buttonMaps : {{name:"LyX", Button:1, pname:"lyx"}, {name:"Eclipse", Button:2, pname:"eclipse"}, {name:"Spotify", Button:3, pname:"Spotify"}, {name:"TaskCoach", Button:3, pname:"TaskCoach"}}
tell application "Finder" to set theBounds to bounds of window of desktop
tell application "System Events"
set bids to bundle identifier of processes where background only is false
end tell
repeat with bid in bids
tell application id bid
if name is not in blacklist then
set appName to name as string
if name is "Terminal" then
set newBounds to {0, 0, (item 3 of theBounds) - 10, item 4 of theBounds}
repeat with theWindow in windows
if visible of theWindow is true then
set bounds of theWindow to newBounds
end if
end repeat
else if name is not in buttonApps then
try
repeat with theWindow in windows
if visible of theWindow is true then
set bounds of theWindow to theBounds
end if
end repeat
end try
else if name is in buttonApps then
-- get the buttonNumber
repeat with buttonApp in buttonMaps
if (name of buttonApp as string) is appName then
set theButton to Button of buttonApp
end if
end repeat
tell application "System Events"
repeat with theProcess in (processes where bundle identifier is bid)
try
tell theProcess to tell window 1 to click button theButton
end try
end repeat
end tell
end if
end if
end tell
end repeat
Ahora, todo lo que tenía que hacer era escribir una similar shell script para llamar a resizer.scpt
y colocarla en ControlPlane y yo estaba a punto de ser perezoso todo de nuevo!
Espero que esto ayude
PS: se me olvido mencionar antes de que todo esto fue hecho por mi de 15 pulgadas MacBook Pro, Lion