A compilation of hidden dock menu additions

Jun 18, '03 10:28:00AM

Contributed by: zeb

I was poking around in the Dock Package recently when I came upon DockMenu.plist. This file has been mentioned before in Add Hide and Hide Others to dock menus, Two ways to pin your 10.1 dock, and a really old hint called Move and Corner your Dock. However, there seem to be slight variations in the syntax used in this file through the different OS versions, so I thought it might be useful to put together an up-to-date hint with a little extra thrown in.

After lots of research and fiddling around, I have discovered many useful commands for adding options to the Dock Menus in Jaguar (I'm running 10.2.3). The command I find most useful is the ability to add "Relaunch Dock" to the Dock menu (control-click on the Dock separator), but I have also found the "Dynamic Integers" to be interesting as well (see the end of this hint for more info on that).

Here is the list of commands I have been able to figure out. There are some gaps that I couldn't solve -- maybe someone else can fill in the blanks. What got me started with all this was the search for a command to Minimize using the hidden "Suck-In" effect. Even though it can be changed in com.apple.dock.plist (or with TinkerTool), I wanted quick access to it via the Dock Menu, but I couldn't find the command. I figured it would be 1032 or somewhere around there. Regardless, here is the list:

1000 - Open (same as clicking on a file/folder/process in the Dock)
1001 - Empty Trash
1002 - Keep in Dock (available only if the process isn't already kept in the Dock)
1003 - Quit
1004
1005 - Show in Finder
1006 - Hide
1007 - Hide Others
1008 - Bring All to Front (same as clicking on an icon in the Dock)
1009 - Turn Hiding ON
1010 - Turn Hiding OFF
1011 - Turn Magnification ON
1012 - Turn Magnification OFF
1013 - Position on Screen (submenu)
1014 - Pinning (submenu)
1015 - Open Dock Preferences...
1016 - Position at TOP
1017 - Position at BOTTOM
1018 - Position at LEFT
1019 - Position at RIGHT
1020 - Pin at START
1021 - Pin at MIDDLE
1022 - Pin at END
1023
1024 - Relaunch / Force Quit (works for processes, not the Dock)
1025 - Relaunch Dock (works for the Dock, not for processes)
1026
1027 - Pin at START (an odd extra)
1028 - Pin at END (another odd extra)
1029 - Minimize Using (submenu)
1030 - Minimize Using GENIE
1031 - Minimize Using SCALE
1032
2000 - SEPARATOR
2001 - "No Windows" (for the Finder when no windows are open)
2002 - "Finder Not Running" / "Application Not Responding" / "URL"
2003 - Minimized Window (the name of the minimized window is inserted)
2004 - Close
Here's how to start making changes to your Dock Menus. Although it seems harmless to change this file, I recommend saving a copy before making any changes. The worst that happened to me was simply having no menus appear due to a simple typo. Navigate to /System -> Library -> CoreServices -> Dock -> Contents -> Resources -> [your language].lproj -> DockMenus.plist.

Open DockMenus.plist in your preferred editor. Notice that there are nine main key elements throughout the file (volumes are treated as folders):
<key>dock</key>
...
<key>file</key>
...
<key>finder-quit</key>
...
<key>finder-running</key>
...
<key>folder</key>
...
<key>minwindow</key>
...
<key>process</key>
...
<key>trash</key>
...
<key>url</key>
Each one defines a set of commands available when you either control-click or click and hold on a particular kind of file in the Dock. The items in the "dock" key element are accessible when you control-click on the separator in the Dock. Most of the commands are in the form:
<dict>
    <key>command</key>
    <integer>1011</integer>
    <key>name</key>
    <string>Turn Magnification On</string>
</dict>
Where the <integer> tag defines the command to be performed, and the <string> tag defines the title of the menu item as it will appear in the Dock Menus (this can be anything you like). Many of the commands will work for most of the above mentioned nine main key elements, but some, for example only apply to the "trash".

So, all you have to do is recreate one of these commands (from the opening "dict" tag to the closing "dict" tag) after the command where you want the new menu item to appear. For example, I added the indicated lines below for an option to relaunch the dock. This menu item will appear below the "Dock Preferences..." when you control-click the Dock separator.
<dict>
    <key>command</key>
    <integer>1015</integer>
    <key>name</key>
    <string>Dock PreferencesĶ</string>
</dict>
<dict>                                   <----- These
    <key>command</key>                   <-----  six
    <integer>1025</integer>              <-----   lines
    <key>name</key>                      <-----    have
    <string>Relaunch Dock</string>       <-----     been
</dict>                                  <-----      added
Another cool option is to add "Pinning" to the Dock submenu of "Dock" (as originally mentioned here).
<dict>
    <key>command</key>
    <integer>1014</integer>
    <key>name</key>
    <string>Pinning</string>
    <key>sub</key>
    <array>
        <dict>
            <key>command</key>
            <integer>1020</integer>
            <key>name</key>
            <string>Start</string>
        </dict>
        <dict>
            <key>command</key>
            <integer>1021</integer>
            <key>name</key>
            <string>Middle</string>
        </dict>
        <dict>
            <key>command</key>
            <integer>1022</integer>
            <key>name</key>
            <string>End</string>
        </dict>
    </array>
</dict>
If you felt like it, you could also add "Top" to the "Position on Screen" submenu. Look for the following lines (and add what I have indicated):
<dict>
    <key>command</key>
    <integer>1013</integer>
    <key>name</key>
    <string>Position on screen</string>
    <key>sub</key>
    <array>
        <dict>
            <key>command</key>
            <integer>1018</integer>
            <key>name</key>
            <string>Left</string>
        </dict>
        <dict>
            <key>command</key>
            <integer>1017</integer>
            <key>name</key>
            <string>Bottom</string>
        </dict>
        <dict>
            <key>command</key>
            <integer>1019</integer>
            <key>name</key>
            <string>Right</string>
        </dict>
        <dict>                            <----- These
            <key>command</key>            <-----  six
            <integer>1016</integer>       <-----   lines
            <key>name</key>               <-----    have
            <string>Top</string>          <-----     been
        </dict>                           <-----      added
    </array>
</dict>
There is no need to log out or even relaunch the Dock. I have found that changes take effect immediately.

A few more things ... notice how commands 2001-2003 are followed by an "enabled" key and a true/false tag? This simply makes the menu item "grayed-out". These are informational menu items and do not perform a task. I have found that these can be hard to read, and changing the "false" tag to a "true" tag helps.

Also, commands 1003 and 1024 are followed by a "dynamic" key and an integer. This is so two commands can occupy the same line and be toggled via a modifier key. You have all seen it when you control-click an app to get the menu where "Quit" lies at the bottom, then pressing the option key changes the command to "Force Quit". You can have any number of commands exist on the same line, as long as they each have a different "dynamic integer", and thus a different modifier invoke the command, and I think the alternate menu options need to follow the first one which has the dynamic integer in it.
Dynamic integers:
    0: -no modifier-
    1: option
    2: command
    3: option + command
    4: control
    5: control + option
    6: control + command
    7: control + option + command
    8: shift
    9: shift + option
    10: shift + command
    11: shift + option + command
    12: shift + control
    13: shift + control + option
    14: shift + control + command
    15: shift + control + option + command
For example, you could add "Quit" to the "Finder" Dock Menu, and make an alternative "Relaunch" option appear when the control key is pressed (NOTE: relaunch doesn't appear to gracefully quit Finder). Add these lines to the "finder-running" section:
<dict>
    <key>command</key>
    <integer>1003</integer>
    <key>dynamic</key>
    <integer>0</integer>
    <key>name</key>
    <string>Quit</string>
</dict>
<dict>
    <key>command</key>
    <integer>1024</integer>
    <key>dynamic</key>
    <integer>1</integer>
    <key>name</key>
    <string>Relaunch</string>
</dict>
<dict>
    <key>command</key>
    <integer>1003</integer>
    <key>dynamic</key>
    <integer>0</integer>
    <key>name</key>
    <string>Quit</string>
</dict>
<dict>
    <key>command</key>
    <integer>1024</integer>
    <key>dynamic</key>
    <integer>1</integer>
    <key>name</key>
    <string>Relaunch</string>
</dict>
NOTE: for some reason, you actually have to add these keys twice, or else it won't work.

You could also make "Hide", "Hide Others," and "Bring All to Front" reside on the same location of menus, where "Hide" is visible, and "Hide Others" and "Bring All to Front" are revealed via the option and option+command keys respectively. Place the following in the "process" section and/or the "finder" section:
<dict>
    <key>command</key>
    <integer>1006</integer>
    <key>dynamic</key>
    <integer>0</integer>
    <key>name</key>
    <string>Hide</string>
</dict>
<dict>
    <key>command</key>
    <integer>1007</integer>
    <key>dynamic</key>
    <integer>1</integer>
    <key>name</key>
    <string>Hide Others</string>
</dict>
<dict>
    <key>command</key>
    <integer>1008</integer>
    <key>dynamic</key>
    <integer>3</integer>
    <key>name</key>
    <string>Bring All to Front</string>
</dict>
[robg adds: I think this hint may well qualify as "the final word" on modifying the dock's contextual menus! Nice work, zeb!]

Comments (23)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030617042055170