创建我自己的Mac应用程序捆绑包来运行shell脚本,在Finder中显示正确的图标,但在Dock中不显示

发布于 2025-02-06 08:20:04 字数 1396 浏览 1 评论 0原文

当我在Finder中查看我的应用程序捆绑包(运行shell脚本)时,它显示了从捆绑包中显示正确的图标。内容>资源> appicon.icns文件。

我创建了该文件如下:

  • 下载了一个我想使用的SVG文件,该文件我想使用
  • 使用GIMP来创建16x16、32x32、64x64、128x128、256x256和512x512 PNG PNG文件
  • 使用ICONUTIL命令来确保appicon.icns文件
  • 视图,以确保 ICONUTIL命令。当我在Finder中发现的AppStore图标文件时,它显示了相同的显示,

我必须复制文件夹结构以获取图标以显示(显然很常见)。

当我将其拖到码头时,我会得到一个从未见过的怪异图标。这不是线条上的圆,这意味着无法运行此应用程序。

它看起来有点像缝纫垫:

  • 3个网格中的3个垂直线和3个水平线
  • 2对角线连接到45度角的角
  • 1大圆圈1大圆圈,它触及边缘
  • 2个较小的中心的较小的同心圆,

任何人都知道为什么它会以这种方式显示这种方式在码头中,还是我如何修复它?它运行正确(目的是如果您好奇的话,请启动QEMU Archlinux Arm VM)。

我的Mac是与蒙特雷的M1,大约两周前刚刚购买了它。

这是我的info.plist文件内容,也许缺少一些必需的键或其他内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>Arch Linux</string>
    <key>CFBundleIdentifier</key>
    <string>me.bantling.ArchLinux</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>CFBundleIconFile</key>
    <string>AppIcon</string>
    <key>CFBundleIconName</key>
    <string>AppIcon</string>
</dict>
</plist>

When I view my app bundle (it runs a shell script) in the Finder, it shows the correct icon, from the bundle > Contents > Resources > AppIcon.icns file.

I created that file as follows:

  • Downloaded an SVG file that I wanted to use
  • Used GIMP to create 16x16, 32x32, 64x64, 128x128, 256x256, and 512x512 png files
  • Used iconutil command to create the AppIcon.icns file
  • View it in Preview to ensure it shows the same sort of display when opening AppStore icons file

I found in the Finder I had to duplicate my folder structure to get the icon to show (apparently very common).

When I drag it to the dock, I get a weird icon I've never seen before. It's not the circle with line through it that means can't run this app.

It looks kind of like a sewing mat:

  • 3 vertical and 3 horizontal lines in a grid
  • 2 diagonal lines connecting corners at 45 degree angles
  • 1 large circle that touches the edges
  • 2 smaller concentric circles in the center

Anyone have any idea why it shows this way in the dock, or how I can fix it? It runs correctly (the purpose is to launch a QEMU ArchLinux ARM VM if you're curious).

My Mac is an M1 with Monterey, just bought it about 2 weeks ago.

Here is my info.plist file contents, maybe it missing some required keys or something:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>Arch Linux</string>
    <key>CFBundleIdentifier</key>
    <string>me.bantling.ArchLinux</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>CFBundleIconFile</key>
    <string>AppIcon</string>
    <key>CFBundleIconName</key>
    <string>AppIcon</string>
</dict>
</plist>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小帐篷 2025-02-13 08:20:04

事实证明我的捆包很好。当我创建了一个新的VM(由于与此问题无关的原因)时,它已解决,将捆绑包复制到新的DIR,并用新的DIR将捆绑包代替了码头中的捆绑包。

图标显示与发现器相同。将原始应用程序放入码头和新应用程序之间也有一些重新启动。

Turns out my bundle was just fine. It was solved when I created a new VM (for reasons unrelated to this issue), copied the bundle to the new dir, and replaced the bundle in the dock with the new one.

The icon showed the same as the Finder. There were also some reboots in between putting the original app in the dock and the new one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文