Coder Social home page Coder Social logo

Comments (12)

meskio avatar meskio commented on July 26, 2024 1

I'm a bit confused reading the code it seems that 16x16 is hardcoded as icon size:
https://github.com/getlantern/systray/blob/master/systray_darwin.m#L162

Is that not true? Does the library support other icon sizes for OS X?

from systray.

myleshorton avatar myleshorton commented on July 26, 2024

@carsonefv or @Derekf5 you guys want to take a look at this?

from systray.

xor-gate avatar xor-gate commented on July 26, 2024

It is far easier than you think you have to create 2 png (imagemagick convert) files with 2x increment in size and then squash them together into a tiff (tiffutil) and then load as normal:

convert -background none img/darwin/$ICON.svg -resize 32x32 -sharpen 1 img/darwin/$ICON.png
convert -background none img/darwin/$ICON.svg -resize 64x64 -sharpen 1 img/darwin/[email protected]
tiffutil -cathidpicheck img/darwin/$ICON.png img/darwin/[email protected] -out img/darwin/$ICON.tiff
$GOPATH/bin/2goarray $ICON main < img/darwin/$ICON.tiff |  grep -v package >> "$OUTPUT"

See:
https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW13

from systray.

liudanking avatar liudanking commented on July 26, 2024

@xor-gate Awesome! It woks like a charm.

from systray.

liudanking avatar liudanking commented on July 26, 2024

@xor-gate I meet another problem:

After I packaged my golang-app into a OSX application, say foo.app, the retina icon is gone.
It seems that OS X add some actions when launching foo.app, but have no idea what did it do.

from systray.

xor-gate avatar xor-gate commented on July 26, 2024

The icon is gone? You must make sure you load the tiff as byte array and not the png.

from systray.

liudanking avatar liudanking commented on July 26, 2024

I mean the retina icon is not shown, only the default one is shown.
I am pretty sure I load the tiff as byte array, because if I copy foo.app/Contents/MacOS/foo to a normal directory, and launch foo with ./foo, the retina icon is displayed as expected.

from systray.

xor-gate avatar xor-gate commented on July 26, 2024

Probably the application bundle loader is not properly configured to have support for multiimage. Could you paste your Plist.info?

from systray.

liudanking avatar liudanking commented on July 26, 2024

Below is my info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist
  SYSTEM 'file://localhost/System/Library/DTDs/PropertyList.dtd'>
<plist version="0.9">
    <dict>
        <key>CFBundleExecutable</key>
        <string>foo</string>
        <key>CFBundleGetInfoString</key>
        <string>hi</string>
        <key>CFBundleIconFile</key>
        <string>app.icns</string>
        <key>CFBundleIdentifier</key>
        <string>foo</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>foo</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>0.0.1</string>
        <key>CFBundleSignature</key>
        <string>WRUN</string>
        <key>CFBundleVersion</key>
        <string>0.0.3</string>
        <!-- Set LSUIElement to indicate this is an agent app, meaning that it
             does not get an icon in the dock. -->
        <key>LSUIElement</key>
        <string>1</string>
    </dict>
</plist>

from systray.

xor-gate avatar xor-gate commented on July 26, 2024

Try adding:

    <key>LSMinimumSystemVersion</key>
    <string>10.10</string>

Probably it changes behaviour how the Foundation.framework is loaded and the image load process.

As: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html

See my Info.plist: https://github.com/xor-gate/syncthing-mac/blob/master/template/Contents/Info.plist

from systray.

liudanking avatar liudanking commented on July 26, 2024

I still can not make it work after adding LSMinimumSystemVersion.
I find your Info.plist have much more items than mine, I will check all these items tomorrow.

from systray.

liudanking avatar liudanking commented on July 26, 2024

@xor-gate With some luck, the problem is solved by adding:

        <key>LSMinimumSystemVersion</key>
        <string>10.10</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>

Many thanks for your help.

from systray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.