Reputation: 300
In my standalone app written in clojure using seesaw to create the gui, and running under OSX, I get a menubar title "main". This appears to be the default for seesaw based programs. I see it in any of the tutorial examples available. Here is what mine looks like:
I have tried renaming the (-main) function. The above image was taken with (-main) renamed to (-soulflyer) so it isn't choosing the title from that. Here is a snippet of the code:
(defn -soulflyer [& args]
(invoke-later
(let [f (make-frame)
details (select f [:#details])
image-pane (select f [:#image])
keyword-tree (select f [:#tree])
8<---snip
Note this was run from the repl, the standalone version needs to have a -main function.
this is a section of the (make-frame) function:
(frame
:title "Keyword Explorer"
:size [1400 :by 800]
:menubar
(menubar :items
[(menu :text "File" :items [])
(menu :text "Edit" :items [])])
:content
8<---snip
so the :title value only affects the title in the window not in the menubar.
Is there any way of changing this from clojure?
Edit: the project.clj file may be useful (rest of the code is at https://github.com/soulflyer/find-pics):
(defproject find-pics "0.1.0-SNAPSHOT"
:description "Search for images containing specified keywords"
:url "http://githube.com/soulflyer/find-pics"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[seesaw "1.4.5"]
[image-lib "0.1.0-SNAPSHOT"]
[com.novemberain/monger "3.0.1"]
[org.clojure/tools.cli "0.3.3"]]
:main find-pics.core
:bin {:name "find-pics"
:bin-path "~/bin"})
Upvotes: 2
Views: 255
Reputation: 29458
Short answer is that you should add :jvm-opts ["-Xdock:name=YOUR_APP_NAME"]
in the project.clj
file.
Java Application in Mac OS X has an application menu. This application menu, by default, contains the full name of the main class as the title. If you want to change this, you can pass -Xdock:name
VM argument like this.
java -Xdock:name=YOUR_APP_NAME ...
It seems that clojure function compiled into Java class. That's why the application menu appears as main
, which is the same as main
function name. Since you can not change the function name, you should add -Xdock:name=YOUR_APP_NAME
to :jvm-opts
.
For more detail, you can read the following document:
Upvotes: 3