Expose stop working after connecting to external monitor

When ever I unplug my MacBook from an external monitor, Expose stops working. The solution to this problem is to kill "Dock" application.  To make it easier, I have created a script which allows you to do the same.

set app_name to "/System/Library/CoreServices/Dock.app/Contents/MacOS/Dock"
set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'")
display dialog "Killingn the application Dock with PID:" & the_pid
if the_pid is not "" then do shell script ("kill -9 " & the_pid)

Copy following lines of code into text editor and copy under $HOME/Library/Scripts/killdock.scpt.  Now you can see the script listed under scripts as an shortcut. You can see "kill dock" listed at the end.

No comments: