Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/mrf345/desktop-entry
- Owner: mrf345
- License: mit
- Created: 2024-08-27T12:51:18.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-09-10T18:29:39.000Z (4 months ago)
- Last Synced: 2024-11-10T06:38:16.230Z (2 months ago)
- Topics: desktop-app, desktop-entry, desktop-environment, go, golang, linux, unix
- Language: Go
- Homepage: https://pkg.go.dev/github.com/mrf345/desktop-entry
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
desktop-entry
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 mainimport (
_ "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 []bytefunc 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)
}
}
```