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?
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 ...
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).
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.
You want DropScript. The dock doesn't work with shell scripts like that, it expects something a bit more full-fledged.
I think if you add LSUIElement to your Info.plist file, it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With