func DataDirs() []string
DataDirs returns a slice of directories where desktop entries are stored.
func RunScript(exec string) (string, error)
RunScript creates a temporary run script consisting of a bash script which removes itself and executes the specified command.
func Scan(dirs []string) ([][]*Entry, error)
Scan non-recursively scans provided directories for desktop entry files and parses them. A slice of parsed entries is returned for each directory.
Entry represents a parsed desktop entry.
type Entry struct {
// Type is the type of the entry. It may be Application, Link or Directory.
Type EntryType
// Name is the name of the entry.
Name string
// GenericName is a generic description of the entry.
GenericName string
// Comment is extra information about the entry.
Comment string
// Icon is the path to an icon file or name of a themed icon.
Icon string
// Path is the directory to start in.
Path string
// Exec is the command(s) to be executed when launched.
Exec string
// URL is the URL to be visited when launched.
URL string
// Terminal controls whether to run in a terminal.
Terminal bool
}
func Parse(content io.Reader, buf []byte) (*Entry, error)
Parse reads and parses a .desktop file into an *Entry.
func (e *Entry) ExpandExec(args string) string
ExpandExec fills keywords in the provided entry's Exec with user arguments.
EntryType may be Application, Link or Directory.
type EntryType int
All entry types
const (
Unknown EntryType = iota // Unspecified or unrecognized
Application // Execute command
Link // Open browser
Directory // Open file manager
)
func (t EntryType) String() string