Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make the dock icon stop bouncing after my app wrapper script starts?

So I recently made an .app wrapper for a zsh script, but when I run it, the icon for the app keeps hopping in the Dock.

The app is basically:

% find Example.app -type f
Example.app/Contents/Info.plist
Example.app/Contents/MacOS/wrapper.sh
% cat Example.app/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <!-- tell OSX what the name of the executable is -->
 <key>CFBundleExecutable</key>
 <string>wrapper.sh</string>
</dict>
</plist>
% cat Example.app/Contents/MacOS/wrapper.sh
#!/usr/bin/env zsh
# not my real script, but something else that hangs for a while
sleep 10
%

You can also grab it from github.

Is there any way I can get the app icon to stop hopping, and act like a normal app, and just sit there with a triangle next to it?

like image 1000
rampion Avatar asked Jun 17 '09 12:06

rampion


People also ask

What causes the Mail icon in the Dock to jump?

This means that particular application needs you—click on the jumping icon and that application will “come forward.” Then you will probably see a message on the screen that needs to be taken care of, such as “Do you want to save this document” or “This application couldn't do what you wanted.” Just do what it wants you ...

Why do icons jump on Mac?

The icon "jumps" when the application needs you attention. You may have tried to quit the application or started the application. switch to it (by clicking the icon in the dock) to see the message(s).


3 Answers

An application's icon will bounce in the OS X Dock until the app enters its main event loop and begins responding to user input. As your script probably doesn't run a Carbon or Cocoa event loop (See documentation for Carbon Event Manager and NSApplication, respectively), the Dock is waiting continuously, expecting a regular foreground GUI application to emerge.

A script-wrapping tool that I've had success with is Platypus. It can run its own event loop while executing your script, and do a number of other convenient things.

like image 195
Draxillion Avatar answered Oct 02 '22 05:10

Draxillion


You want DropScript. The dock doesn't work with shell scripts like that, it expects something a bit more full-fledged.

like image 26
Jim Puls Avatar answered Sep 28 '22 05:09

Jim Puls


I think if you add LSUIElement to your Info.plist file, it should work.

like image 28
user2199684 Avatar answered Sep 29 '22 05:09

user2199684