Ever mishap with your mouse? Cruising over your desktop click, rub, stumble and chatter across the dock whilst the click persists grabbing the DOCKED app ICON on its fumbling way and BAM! Off goes your DOCK app in to the voided cloud of a cartoon (see below) leaving you guessing waht freaking app was that!! Its crazy, not too, just crazy enough to frustrate the heck out of ya!
If you have not experienced this or if you have and did not know what the ICON was or how to get the icon back this little script below helps you. The script simply locks and unlocks the DOCK APP ICONS from the OS X DOCK for addition or Removal.
Note when the DOCK is NOT LOCKED you can right mouse button click on ANY running app in the DOCK and add click on "KEEP IN DOCK" to keep it in THE DOCK!
Further, if you want to remove an app from a dock simply click it drag it off of the dock and it will be removed. And here is the problem. Sometimes you click on the dock and move the mouse a little to fast and poof the cloud of destruction hits.
What makes this more confusing if your APP is actually running the APP stays in the dock until you close the app and the LAUNCHER ICON has been removed from the DOCK and you may not notice this immediately.
Hence, LOCK THE DOCK!!
dash.sh
if [[ "$1" == unlock || "$1" == UNLOCK || "$1" == u ]]; then defaults write com.apple.dock contents-immutable -bool FALSE ECHO Dock is now UNLocked else defaults write com.apple.dock contents-immutable -bool TRUE ECHO Dock is now Locked fi
killall Dock |
Quick and warranted explanation of the dash.sh script:
We simply take an argument to UNLOCK the document anything else an argument OR no ARGUMENT will lock the dock. This is just a design and warrants no further architectural thought. Its script.
The defaults write com.apple.dock contents-immutable -bool simply sets the dock to be locked or unloked on the boolean variable "contents-immutable" being set to TRUE/FALSE
Killall DOCK simply kills and restarts the MAC OS X DOCK. That's it....
Here are the aliases in the .bash_profile below:
alias dloc='~/bin/lock.sh LOCK'
alias dunl='~/bin/lock.sh UNLOCK'
Calling the dash.sh script from at startup can lock your DOCK as the default simply execute the following:
~/bin/lock.sh LOCK
If you need to unlock and rearrange drop to the shell and execute the following:
~/bin/lock.sh UNLOCK or your ALIAS dunl
I lock my DOCK from the .profile startup file. I want the DOCK to be default locked as this is something I change rarely.
As a result this is the system startup state that I chose for my work environment!
tags: dock lock osx dock dock lock dock app osx mac apple
AAPL
links: digg this del.icio.us technorati reddit