zegervdv / homebrew-zathura

Homebrew formulae to build Zathura on Mac OS X
553 stars 43 forks source link

I made an app icon #122

Open brosasaki opened 7 months ago

brosasaki commented 7 months ago

I took the icon svg from Zathura's original repository and made a MacOS style icon for it. If you right-click -> info on the 'zathura' executable, copy the .icns file in the zip, click the icon in the info pan, then paste, it will change the icon that shows up in the dock. I'm not sure how to integrate this into the actual distribution, though.

zathura-brosasaki icons.zip I release this work to the public domain.

zegervdv commented 7 months ago

That's very nice. To be able to bundle it, I think we need to find a way to turn this into an actual .app. That way we could also distribute this as a prebuilt cask. But I haven't really looked into how to do that.

ParadoxPacer commented 3 months ago

i found a way to turn it into a .app file.

if you just follow this to install zathura and get it working on macos, turning it into a .app is actually pretty easy.

Step 1: Create a Directory Structure for the .app Bundle

  1. Create a New Directory:
mkdir -p MyApp.app/Contents/MacOS
mkdir -p MyApp.app/Contents/Resources
  1. Move Your Executable:

cp /path/to/your/executable MyApp.app/Contents/MacOS/zathura

Step 2: Create an Info.plist File

  1. Create the Info.plist:

nano MyApp.app/Contents/Info.plist

  1. Add the Following XML Content to the Info.plist File:
<?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>CFBundleName</key>
    <string>MyApp</string>
    <key>CFBundleDisplayName</key>
    <string>MyApp</string>
    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.myapp</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>CFBundleExecutable</key>
    <string>zathura</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleIconFile</key>
    <string>AppIcon</string>
</dict>
</plist>

Step 3: Add an Icon (Optional)

  1. Create or Obtain a .icns File:
  1. Place the .icns File in the Resources Directory:

cp /path/to/your/icon.icns MyApp.app/Contents/Resources/AppIcon.icns

Step 4: Make the Executable and the App Bundle Executable

  1. Ensure the Executable has the Correct Permissions:

chmod +x MyApp.app/Contents/MacOS/zathura

Step 5: Test the .app File

Step 6: (Optional) Move the App to Applications

mv MyApp.app /Applications/ Now you have a .app bundle that runs your Unix executable and can be launched like any other macOS application.

So thats how i got the zathura executable working as a .app on macos. i could upload the .app if you want.

LoveIiei commented 1 month ago

Just a comment if you run into trouble

if you followed all the steps and tried to paste the icon onto the original black icon, and it did nothing. Then, you can scroll to the bottom and check if you have write permission or only read. If not, you can check the write and try pasting again.