desktopentry

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package desktopentry escapes and reads the string values of a freedesktop Desktop Entry file, chiefly the Exec key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(argv ...string) string

Exec builds an Exec= value from argv. argv[0] is always double-quoted; any other argument is quoted when it is empty (written `""`) or holds a reserved character: space, tab, CR, LF, `"`, `'`, `\`, `>`, `<`, `~`, `|`, `&`, `;`, `$`, `*`, `?`, `#`, `(`, `)` or "`". Inside quotes `"`, "`", `$` and `\` are backslash-escaped. Every `%` becomes `%%`. Then the whole line gets the string escapes, because the spec undoes those before the Exec quoting: `\` doubled, a tab as `\t`, CR as `\r` and LF as `\n`. Field codes (%u, %f) are appended by the caller after the call.

func SplitExec

func SplitExec(value string) []string

SplitExec is Exec's reader, for any program's entry: it undoes the string escapes, then the quoting, then `%%`, and returns the arguments. Every other field code (%u, %f, ...) is left in place for the caller to expand. Because `%%` is undone, an argument written `%%u` and a field code `%u` both read back as `%u`.

func Value

func Value(s string) string

Value escapes s as a Desktop Entry string value: `\` doubled, a tab as `\t`, a leading space as `\s`, and a line break (CR or LF) as a space, since one would end the key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL