Toggle application dimming
Last modification: Monday, August 25, 2008 12:47 amToggles the Dock behavior to present hidden applications as dimmed icons.
Implementation
-- Get the current value for the preference settingtry
set _bitSet to do shell script "defaults read com.apple.dock showhidden"
set _bitSet to _bitSet as integer
set _bitSet to _bitSet as boolean
on error
set _bitSet to false
end try
-- Quit the Dock, allowing recent changes by the user to be saved
tell application "Dock" to quit
repeat 30 times
tell application "System Events" to if (exists process "Dock") is false then exit repeat
delay 0.1
end repeat
-- Launch the Dock
tell application "Dock" to launch
repeat 30 times
tell application "System Events" to if (exists process "Dock") then exit repeat
delay 0.1
end repeat
if _bitSet then
-- Turn off application dimming
do shell script "defaults write com.apple.dock showhidden -boolean NO; killall -hup Dock"
else
-- Turn on application dimming
do shell script "defaults write com.apple.dock showhidden -boolean YES; killall -hup Dock"
delay 3
-- Cycle state of hidden applications to refresh their icon in the Dock
tell application "System Events"
set _hiddenProcesses to every process whose visible is false
repeat with _i from 1 to count of _hiddenProcesses
try
set visible of (item _i of _hiddenProcesses) to true
delay 0.1
set visible of (item _i of _hiddenProcesses) to false
end try
end repeat
end tell
end if