#shell #icons #animated #script #click #mac #macos

app laic

A simply CLI tool for generating animated app icons on Mac

1 unstable release

0.1.0 Jun 7, 2023

#2900 in Command line utilities

MIT license

29KB
575 lines

Live App Icon for Mac

Animated app icons on your Dock, which can perfom an arbitrary shell script on click.

Requirements

  • macOS 13 (Ventura) or higher
  • Xcode (or at least xcodebuild) version 14.1 or higher
  • Apple Development Certificate
  • Not too old git

If you have the latest version of Xcode, the above requirements should be met.

Install laic

laic (Live App Icon Creator) is a simple CLI tool to generate Live App Icons on macOS. There are 2 ways to install laic: using cargo from Rust or download a binary.

Use cargo

If you are a Rust developer, the easiest way to install laic is with cargo, since it is published on crate.io.

cargo install laic

Download a binary

There are pre-compiled binraies in the release page. You can manually download and install it in an appropriate location (e.g. /usr/local/bin). Select laic-aarch64-apple-darwin if you are using Apple Silicon Mac, or laic-x86_64-apple-darwin if Intel Mac.

The following one line command will automatically download and install laic to /usr/local/bin on Apple Silicon Mac:

curl -L -o laic https://github.com/fujidaiti/live-app-icon/releases/download/v0.0.1/laic-aarch64-apple-darwin && chmod +x ./laic && sudo mv ./laic /usr/local/bin

Or on Intel Mac:

curl -L -o laic https://github.com/fujidaiti/live-app-icon/releases/download/v0.0.1/laic-x86_64-apple-darwin && chmod +x ./laic && sudo mv ./laic /usr/local/bin

Usage

laic requires at least 3 arguments:

  • --name : Name of the app to be generated. Used as its display name in the dock and app launcher.
  • --gif : Path to an animated GIF to be used as the icon of the app. If the width and height of the image are not equal, the image will be resized to a square according to the specified resize method.
  • --command : Shell command to be executed when the generated app is clicked.

The below is an example to generate an animated app icon that is named as "GitHub" that, when clicked, opens the home page of GitHub in your default browser when clicked.

laic --name "GitHub" --gif path/to/your/gif --command "open https://github.com"

There are other options that laic accepts:

  • --resize-method : Specifies how the given GIF will be resized to square. See Resize method for more details.

  • --install-location : Path to a directory the app to be installed. The default is $HOME/Applications.

  • --install-action : Specify the action to be taken when the app is successfully installed. launch launches the app immediately, open-in-finder opens the directory where the app is installed in the Finder, and none does nothing. The default is launch.

  • --verbose : Noisy logging, including all shell commands executed.

Run laic --help for more information.

Resize method

If the with and height of the given animated GIF is not equal, laic resizes it to a square according to a specified resize method:

  • center-crop : Crops the center of the image with a square whose sides are the same size as the shorter side of the image.
  • center-fit : Puts the image on the center of a transparent square whose sides are the same size as the longer side of the image.

The default method is center-fit.

After installation is finished

Keep the app in Dock

It is recommended enabling the "Keep in Dock" option for the app so that the nice animation always catches your eye 👀.

keep-in-dock

Login Items

When the generated app launchs for the first time, it automatically adds itself to Login Items. This is because the animation of the app icon is only available while the app is running. You might notice that if you quit the app, the animation also stops.

add-to-login-items

Allow notifications

In addition, the app will also require the permission to send notifications at the first launch. It will notify you in a notificaation if an error occurs while running the command.

notification-request

Integrate with Shortcuts

Since the generated app can run arbitrary shell commands, it is easy to perform complex workflows created with Shortcuts. Did you know that we can also run the shortcuts from the command line? For example, to run a shortcut named "My Shortcut", you could use the following:

shortcuts run "My Shortcut"

Then it is easy to integrate this shortcut with App Live Icon as follows:

laic --label "My Shortcut" --command "shortcuts run \"My Shortcut\"" --gif path/to/your/gif

Notice that you need to escape the doube quotes in --command part since the shortcut name contains a whitespace. You can read Run shortcuts from the command line for more information about shortcuts command.

Uninstall

laic

laic is just an executable file. You can remove it like sudo rm /usr/local/bin/laic , or move it to the Trash by hand.

Generated apps

Just move it to the Trash. The default install location is $HOME/Applications unless you specify a specific directory at creation. You may also need to remove the app from Login Items and the Notifications section in the System Setting.

Troubleshooting

If you try to run the laic you downloaded, you might see a warning dialog like the one in the image below. This is because the binary is not signed by the identified developer. In this case, you must manually allow the app to run according to this article: [Open Mac app from unidentified developer](https://support.apple.com/guide/mac-help/open-a-mac-app-from-an- unidentified-developer-mh40616/mac).

warning-dialog

Thanks

<iframe src="https://giphy.com/embed/L3iUyZxjNJ080YJnlt" width="300" height="300" frameBorder="0" class="giphy-embed" allowFullScreen></iframe>

via GIPHY

Contributing

If you find any bugs or have suggestions for improvement, please create an issue or a pull request on the GitHub repository. Contributions are welcome and appreciated!

TODO

CLI tool

  • Validate the arguments
  • Refactor the code
  • Add option to notify the command's output
  • Improve the report messages
  • Add tests

Others

  • Create a GUI icon generator

  • Provide a way to create animated icons without Xcode

Dependencies

~13–23MB
~300K SLoC