krypted.com

Tiny Deathstars of Foulness

One of those annoying little things is when you ARD into a system and the Dock is nowhere to be seen. Why do we (or should I say they) autohide Docks on servers? Either way, when I ARD into a box and I don’t see a Dock I have this line saved as a Template: defaults write com.apple.dock autohide -bool false; killall Dock By writing an autohide key that is false into com.apple.dock for the currently logged in user, I don’t have to deal with the Dock disappearing any more. You need to kill the Dock and let it respawn, thus the killall as well. Once I’m done working with the box, I can show the dock again: defaults write com.apple.dock autohide -bool true; killall Dock Or, instead of all this, as diskutant once pointed out, just use Command-Option-d when you ARD in and then again when you log out!

August 30th, 2012

Posted In: Mac OS X

Tags: , , , , , , ,

Using Mac OS X, one of the most trivial things (provided you have permission) is to add an object to the dock. Applications go on the left side of the dock and folders/documents/stacks go on the right. From the command line it isn’t quite as trivial but not that complicated either. To do so from the command line, you can write directly into the com.apple.dock.plist for a user. To do so, we’re going to use the defaults command and we’re going to look at adding an application first:
defaults write com.apple.dock persistent-apps -array-add ‘<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Office 2008/Microsoft Word</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>’
You can also add a custom title for the object that you are adding by using the file-label key and providing a string with the content that you want the label to have. You can also add a folder or file to the dock using a similar command:
defaults write com.apple.dock persistent-apps -array-add “<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Users</string><key>_CFURLStringType</key><integer>0</integer></dict><key>file-label</key><string>UsersDirectory</string><key>file-type</key><integer>18</integer></dict><key>tile-type</key><string>directory-tile</string></dict>”
You can also write  an object using a variable, or another command when wrapped with “. For example, if we wanted to put a link to the specific users directory rather than the /Users directory we would use the following:
defaults write com.apple.dock persistent-apps -array-add “<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Users/`whoami`</string><key>_CFURLStringType</key><integer>0</integer></dict><key>file-label</key><string>MyHome</string><key>file-type</key><integer>18</integer></dict><key>tile-type</key><string>directory-tile</string></dict>”
There are several uses for this. For example, you can link to certain folders that allow you to access recently changed content. Provided you have mounted a network share you can also add a network directory, similar to what happens when you add your Network Home in managed preferences. But this gets the process started and from here it’s just figuring out your specific logic. Once you have added an item into the Dock you’ll then need to restart it:
killall Dock
You should then see your Dock item. It is worth noting that if the location does not exist then you will need to create it and so you might script some logic as such. Also, if you create the location after creating the item then you will need to restart the Dock again.

August 2nd, 2010

Posted In: Mac OS X, Mass Deployment

Tags: , , , , , , , , ,