Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ go get github.com/machinebox/appify
appify -name "My Go Application" -icon ./icon.png /path/to/bin
```

It will create a macOS Application.
This will create a regular macOS Application, the `-menubar` flag can be set to create a menu bar only app.

## What next?

Expand Down
19 changes: 14 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ func main() {

func run() error {
var (
name = flag.String("name", "My Go Application", "app name")
author = flag.String("author", "Appify by Machine Box", "author")
version = flag.String("version", "1.0", "app version")
identifier = flag.String("id", "", "bundle identifier")
icon = flag.String("icon", "", "icon image file (.icns|.png|.jpg|.jpeg)")
name = flag.String("name", "My Go Application", "app name")
author = flag.String("author", "Appify by Machine Box", "author")
version = flag.String("version", "1.0", "app version")
identifier = flag.String("id", "", "bundle identifier")
icon = flag.String("icon", "", "icon image file (.icns|.png|.jpg|.jpeg)")
menubaronly = flag.Bool("menubar", false, "Make a menu bar only app")
)
flag.Parse()
args := flag.Args()
Expand Down Expand Up @@ -78,6 +79,7 @@ func run() error {
Version: *version,
InfoString: *name + " by " + *author,
ShortVersionString: *version,
MenuBarOnly: *menubaronly,
}
if *icon != "" {
iconPath, err := prepareIcons(*icon, resouresPath)
Expand Down Expand Up @@ -151,6 +153,7 @@ type infoListData struct {
InfoString string
ShortVersionString string
IconFile string
MenuBarOnly bool
}

const infoPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -177,6 +180,12 @@ const infoPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
<key>CFBundleIconFile</key>
<string>{{ .IconFile }}</string>
{{- end }}
<key>NSHighResolutionCapable</key>
<true/>
{{ if .MenuBarOnly -}}
<key>LSUIElement</key>
<true/>
{{- end }}
</dict>
</plist>
`
Expand Down