Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrf345/desktop-entry

Generate and update .desktop (desktop entry) files for Go binaries automatically.
https://github.com/mrf345/desktop-entry

desktop-app desktop-entry desktop-environment go golang linux unix

Last synced: 25 days ago
JSON representation

Generate and update .desktop (desktop entry) files for Go binaries automatically.

Awesome Lists containing this project

README

        



desktop-entry




Go Reference

Generate and update .desktop (desktop entry) files for Go binaries automatically.

### Install

To add it to your project

```shell
go get https://github.com/mrf345/desktop-entry@latest
```

### How it works

With the default settings `desktopEntry.Create()` will check your `~/.local/share/applications` for a .desktop file, that matches your apps name, if it can't find it, it'll create a new one. That will later on be updated it only when the binary path changes.

### Example

```go
package main

import (
_ "embed"
"fmt"
"os"

desktopEntry "github.com/mrf345/desktop-entry"
)

// assuming you have an existing icon.png file to embed
//go:embed icon.png
var icon []byte

func main() {
// Create an instance and pass the required settings
appName := "Desktop Entry"
appVersion := "0.0.1"
entry := desktopEntry.New(appName, appVersion, icon)

// Some optional settings (check https://pkg.go.dev/github.com/mrf345/desktop-entry#DesktopEntry)
entry.Comment = "package to help creating desktop entry file for Go"
entry.Categories = "accessories;Development;"
entry.Arch = "arm64"

// Make sure to always run it at the beginning of your main function
if err := entry.Create(); err != nil {
panic(err)
}
}
```