Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Is this only while the program is not running, or only when running, or always? –  Arjan Dec 2 '10 at 19:13
add comment

2 Answers

up vote 5 down vote accepted

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:

  1. The application no longer has a menubar
  2. The application does no longer appear in the Cmd-Tab list 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 Info.plist.

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 <dict>:

<key>LSUIElement</key>
<true/>

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.

share|improve this answer
    
Very rarely, property list files are a third format. It's considered obsolete, and I don't know what you need to enter to accomplish this in that other format. –  Daniel Beck Dec 2 '10 at 19:06
    
I guessed other .plist formats might be converted using plutil, but that only knows of 2 formats too. –  Arjan Dec 2 '10 at 19:12
    
@Arjan Property List Editor can read that third format, "Text Property List" (the others being XML and Binary), and even has an option to save in that format, but it's not implemented. It's an interesting idea though, and it just might work. –  Daniel Beck Dec 2 '10 at 19:38
    
Thanks, editing the Info.plist is simple enough. Love the fact that it doesn't appear in the Application Switcher as well. –  cynicaljoy Dec 2 '10 at 21:01
    
@Daniel You can convert between xml and plain text plists with pl. –  Lri Mar 9 '11 at 0:02
show 6 more comments

Alternatively... (Building on the answer from @Daniel Beck)...

Open the same Info.plist in Xcode

  • Right click within the top-level Information Property List key and select Add Row
  • Type Application is agent (UIElement) as the new key
  • Set the new key's value to YES
  • Save
  • Restart the corresponding application to see results
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.