Is there away to toggle an Application Icon in the OS X Dock? Specifically I was hoping to be able to use the 'deafults' command to toggle something within the given application.
If you want to remove the icon when the application is not running:
Click and hold (drag) it from the Dock, and release it somewhere else. If the application is running, the icon will move back to the Dock, but will disappear whenever you quit the application. If it's not running, the icon will disappear in a "cloud of smoke".
Alternatively, right-click the application icon in the Dock, and select Options, then toggle Keep in Dock.
If you want to also hide the icon when the application is running:
There is a way, but is presents two problems:
- The application no longer has a menubar
- The application does no longer appear in the
Cmd-Tablist of programs
The application still responds to keyboard shortcuts defined for menu items, so if you're comfortable controlling the application only using these, it's possible.
It looks a bit like what opens when you select the "[Program Name] Help" menu item in the Help menu.
To accomplish it:
You need to edit the file
Info.plist in the application's bundle. To do this, right-click the application and choose "Show Package Contents". Navigate to
Contents, and edit
The file format is usually XML, which you can edit with any plain text editor, such as TextWrangler, BBEdit, TextMate, or even TextEdit.
Insert the following lines directly after the line containing
Save the file and restart the application.
In case the file format is not XML, but binary (the binary file starts with
bplist, followed by binary "junk"), you need Property List Editor, which is part of Apple's developer tools (you can, of course, always use PLE if you have it installed)
Open the file in PLE, and select "Add Item". Type "Application is agent (UIElement)", which will autocomplete. Check the value box, and save.
Alternatively... (Building on the answer from @Daniel Beck)...
Open the same Info.plist in Xcode
- Right click within the top-level
Information Property Listkey and select
Application is agent (UIElement)as the new key
- Set the new key's value to
- Restart the corresponding application to see results