yarr/doc/platform.md
2021-02-03 21:18:09 +00:00

3.3 KiB

Incomplete & inaccurate platform-specific notes.

MacOS Icon

The format for desktop apps is .icns. AFAIK, the format is not open (even though it had been reverse-engineered), and I couldn't find any 3rd party tool that'd fully support it.

The easiest way for creating icon file is either via Xcode, or by using built-in iconutil command that ships with MacOS.

The steps are provided below:

$ sips -s format png --resampleWidth 1024 source.png --out /path/to/icons/icon_512x512@2x.png
$ sips -s format png --resampleWidth  512 source.png --out /path/to/icons/icon_512x512.png
$ sips -s format png --resampleWidth  256 source.png --out /path/to/icons/icon_256x256.png
$ sips -s format png --resampleWidth  128 source.png --out /path/to/icons/icon_128x128.png
$ sips -s format png --resampleWidth   64 source.png --out /path/to/icons/icon_32x32@2x.png
$ sips -s format png --resampleWidth   32 source.png --out /path/to/icons/icon_32x32.png
$ sips -s format png --resampleWidth   16 source.png --out /path/to/icons/icon_16x16.png
$ iconutil -c icns /path/to/icons -o icon.icns

Windows Icon

Terminology:

Windows Icons are directly embedded to the binary. To do so one needs to provide .syso file prior to compiling Go code, which will be passed to the linker. So, basically .syso is any object file that the linker understands.

More info here: ticket & commit.

Note to self: running go build main.go won't embed .syso file if it isn't located in a package directory.

Tools to create .syso files:

  • windres: ships with mingw (gnu tools for windows)
  • [rsrc][rsrc]: written in Go, wasn't considered at the time due to the critical bug with icon alignment
  • goversioninfo: rsrc wrapper with manifest file creation via json