desktop

package
v0.0.0-...-a0d3116 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package desktop implements the Desktop Entry Spec. For more information, please see the spec: http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingType means that the desktop entry is missing the
	// Type key, which is always required.
	ErrMissingType = errors.New("missing entry type")

	// ErrMissingName means that the desktop entry is missing the
	// Name key, which is required by the types Application, Link,
	// and Directory.
	ErrMissingName = errors.New("missing entry name")

	// ErrMissingURL means that the desktop entry is missing the URL
	// key, which is required by the type Link.
	ErrMissingURL = errors.New("missing entry url")
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Name string
	Icon string
	Exec string
}

Action is an Action group.

type Entry

type Entry struct {
	// The type of desktop entry. It can be: Application, Link, or
	// Directory.
	Type Type
	// The version of spec that the file conforms to.
	Version string

	// The real name of the desktop entry.
	Name string
	// A generic name, for example: Text Editor or Web Browser.
	GenericName string
	// A short comment that describes the desktop entry.
	Comment string
	// The name of an icon that should be used for this desktop
	// entry.  If it is not an absolute path, it should be searched
	// for using the Icon Theme Specification.
	Icon string
	// The URL for a Link type entry.
	URL string

	// Whether or not to display the file in menus.
	NoDisplay bool
	// Whether the user has deleted the desktop entry.
	Hidden bool
	// A list of desktop environments that the desktop entry should
	// only be shown in.
	OnlyShowIn []string
	// A list of desktop environments that the desktop entry should
	// not be shown in.
	NotShowIn []string

	// Whether DBus Activation is supported by this application.
	DBusActivatable bool
	// The path to an executable to test if the program is
	// installed.
	TryExec string
	// Program to execute.
	Exec string
	// The path that should be the programs working directory.
	Path string
	// Whether the program should be run in a terminal window.
	Terminal bool

	// A slice of actions.
	Actions []*Action
	// A slice of mimetypes supported by this program.
	MimeType []string
	// A slice of categories that the desktop entry should be shown
	// in in a menu.
	Categories []string
	// A slice of interfaces that this application implements.
	Implements []string
	// A slice of keywords.
	Keywords []string

	// Whether the program will send a "remove" message when started
	// with the DESKTOP_STARTUP_ID env variable is set.
	StartupNotify bool
	// The string that the program will set as WM Class or WM name
	// hint.
	StartupWMClass string

	// Extended pairs. These are all of the key=value pairs in which
	// the key follows the format X-PRODUCT-KEY. For example,
	// accessing X-Unity-IconBackgroundColor can be done with:
	//
	//	entry.X["Unity"]["IconBackgroundColor"]
	//
	X map[string]map[string]string
}

Entry represents a desktop entry file.

func New

func New(r io.Reader) (*Entry, error)

New reads a desktop file from r and returns an Entry that represents the desktop file using the default locale.

func NewWithLocale

func NewWithLocale(r io.Reader, l keyfile.Locale) (*Entry, error)

NewWithLocale reads a desktop file from r and returns an Entry that represents the desktop file using the given locale l.

func (*Entry) Launch

func (de *Entry) Launch(uris ...string) error

Launch TODO

type Type

type Type uint8

Type is the type of desktop entry.

const (
	None Type = iota // No type. This is bad.
	Application
	Link
	Directory
	Unknown // Any unknown type.
)

These are the possible desktop entry types.

func ParseType

func ParseType(s string) Type

ParseType converts the given string s into a Type.

func (Type) String

func (t Type) String() string

String returns the Type as a string.

Jump to

Keyboard shortcuts

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