desktop

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 13 Imported by: 0

README

desktop

GoDoc builds.sr.ht status Donate

Desktop entry scanner and parser

Linux is currently the only supported operating system. Windows support is planned.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataDirs

func DataDirs() []string

DataDirs returns a slice of directories where desktop entries are stored.

func RunScript

func RunScript(ex string) (string, error)

func Scan

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.

Types

type 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
}

Entry represents a parsed desktop entry.

func Parse

func Parse(content io.Reader, buf []byte) (*Entry, error)

Parse reads and parses a .desktop file into an *Entry.

func (*Entry) ExpandExec

func (e *Entry) ExpandExec(args string) string

ExpandExec fills keywords in the provided entry's Exec with user arguments.

type EntryType

type EntryType int

EntryType may be Application, Link or Directory.

const (
	Unknown EntryType = iota
	Application
	Link
	Directory
)

func (EntryType) String

func (t EntryType) String() string

Jump to

Keyboard shortcuts

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