简体   繁体   English

如何在 Mac 上为 Clojure 应用程序显示 Dock 图标?

[英]How do I get the Dock icon to appear for a Clojure app on a mac?

Currently nothing (not even the java coffee cup) appears.目前没有出现(甚至没有出现 java 咖啡杯)。

I created my app using lein new reagent name and I've tried these jvm options:我使用lein new reagent name创建了我的应用程序,并尝试了这些 jvm 选项:

java -Xdock:name=Name
     -Xdock:icon=/Users/bmaddy/Downloads/logo.jpg
     -Dapple.awt.UIElement=true
     -Djava.awt.headless=false
     -jar name.jar

Why not use Java interop ?为什么不使用 Java 互操作? Following this SO post question :按照这个SO post问题:

// let's translate this
import com.apple.eawt.Application;
...
Application application = Application.getApplication();
Image image = Toolkit.getDefaultToolkit().getImage("icon.png");
application.setDockIconImage(image);

// into Clojure
(import com.apple.eawt.Application java.awt.Toolkit)
(let [app (Application/getApplication)
      image (.getImage (Toolkit/getDefaultToolkit) "icon.png")]
   (.setDockIconImage app image)))

It turns out that just using Seesaw does something that makes the dock icon appear.事实证明,仅使用Seesaw就可以使停靠栏图标出现。 That's good enough for what I need.这足以满足我的需要。

(ns name.server
  (:use seesaw.core)

Other stuff I tried:我试过的其他东西:

The automator method described here only gave an icon to start the app and it didn't stick around while it was running: https://discussions.apple.com/thread/4805123此处描述的 automator 方法只提供了一个启动应用程序的图标,并且在运行时没有停留: https : //discussions.apple.com/thread/4805123

There's some good ideas here, but I wasn't able to get any of them to work: https://apple.stackexchange.com/questions/191609/how-to-create-a-app-folder-from-an-executable-jar这里有一些好主意,但我无法让其中任何一个发挥作用: https : //apple.stackexchange.com/questions/191609/how-to-create-a-app-folder-from-an-可执行文件

Building an .app package from scratch led to a bunch of LSOpenURLsWithRole() failed with error -10810 errors I wasn't able to solve, but that seems like it would be the most correct way to do it.从头开始构建.app包导致一堆LSOpenURLsWithRole() failed with error -10810错误我无法解决,但这似乎是最正确的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM