desktopentry

package
v0.0.0-...-e4d0a0c Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: GPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name string
	Icon string
	Exec string

	SnapAppName string
}

Action represents an application action defined in a desktop entry file.

type DesktopEntry

type DesktopEntry struct {
	Filename string
	Name     string
	Icon     string
	Exec     string

	SnapInstanceName string
	SnapAppName      string

	Hidden                bool
	OnlyShowIn            []string
	NotShownIn            []string
	GnomeAutostartEnabled bool

	Actions map[string]*Action
}

DesktopEntry represents a freedesktop.org desktop entry file.

The various fields are as defined in the specification: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

func Read

func Read(filename string) (*DesktopEntry, error)

Read parses a desktop entry file.

func (*DesktopEntry) ExpandActionExec

func (de *DesktopEntry) ExpandActionExec(action string, uris []string) ([]string, error)

ExpandActionExec returns the command line used to launch the named action of the desktop entry.

func (*DesktopEntry) ExpandExec

func (de *DesktopEntry) ExpandExec(uris []string) ([]string, error)

ExpandExec returns the command line used to launch this desktop entry.

Macros will be expanded, with the %f, %F, %u, and %U macros using the provided list of URIs

func (*DesktopEntry) ShouldAutostart

func (de *DesktopEntry) ShouldAutostart(currentDesktop []string) bool

ShouldAutostart returns true if this desktop file should autostart on the given desktop.

currentDesktop is the value of $XDG_CURRENT_DESKTOP split on colon characters.

Jump to

Keyboard shortcuts

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