Documentation ¶
Index ¶
- Constants
- Variables
- func AddCommandsToConfig(conf *config.Config, commands map[string]Command, override bool) error
- func AddShortcutsToConfig(conf *config.Config, shortcuts map[string]ShortCut, override bool) error
- func GetRegisteredProviderFun() map[string]NewEntryProviderFun
- func RegisterEntryType[T Entry]() error
- func ScanDirectory(dir string, blacklist map[string]struct{}) (map[string]DesktopFile, error)
- func ScanMulti(directories []string, blacklist map[string]struct{}) (map[string]DesktopFile, error)
- func Serialize(entry Entry) ([]byte, error)
- func SerializeWithOptions(entry Entry, options map[string]string) ([]byte, error)
- func SetApplicationConfig(conf *config.Config, pythonPath string, blacklist []string, ...) errordeprecated
- func SetDfConfig(conf *config.Config, blacklist []string) error
- func SetPathProviderSettings(conf *config.Config, settings PathProviderSettings) error
- type Applicationdeprecated
- type ApplicationProviderdeprecated
- type Command
- type CommandProvider
- type DesktopFile
- type DesktopFileProvider
- type Entry
- type EntryProvider
- func GetProviders(conf *config.Config, options map[string]string, ...) ([]EntryProvider, error)
- func NewApplicationProvider(conf *config.Config, options map[string]string) (EntryProvider, error)deprecated
- func NewCommandProvider(conf *config.Config, options map[string]string) (EntryProvider, error)
- func NewDesktopFileProvider(conf *config.Config, options map[string]string) (EntryProvider, error)
- func NewPathProvider(conf *config.Config, options map[string]string) (EntryProvider, error)
- func NewShortcutProvider(conf *config.Config, options map[string]string) (EntryProvider, error)
- type MapProvider
- type NewEntryProviderFun
- type Path
- type PathProvider
- type PathProviderSettings
- type ShortCut
- type ShortCutProvider
Constants ¶
const ( PathProviderKey = "path-provider" OptionBaseDirectory = "base-directory" OptionHideFiles = "hide-files" OptionHideFolders = "hide-folders" OptionIgnoreVCS = "no-ignore-vcs" )
const ApplicationProviderKey = "application-provider"
Uniform identifier
Deprecated: use DesktopFileProvider for fewer dependencies and issues
const CommandProviderKey = "command-provider"
const DesktopFileProviderKey = "desktopFile-provider"
const ShortCutProviderKey = "shortcut-provider"
Variables ¶
var ( ErrNotFound = errors.New("entry not found in this provider") ErrRemoteRequired = errors.New("a remote is required for this entry") )
var ( ErrTypeAlreadyRegistered = errors.New("type already registered") ErrTypeNotRegistered = errors.New("type not registered") ErrVersionMisMatch = errors.New("serialized entry was built with a different version of the launcher") )
var (
ErrInvalidScheme = errors.New("forbidden scheme in URL")
)
var (
ErrKeyNotHandled = fmt.Errorf("key not handled")
)
var ErrUnableToRemoteLaunchCommand = errors.New("unable to RemoteLaunch() this command")
Functions ¶
func AddCommandsToConfig ¶
func AddShortcutsToConfig ¶
func GetRegisteredProviderFun ¶
func GetRegisteredProviderFun() map[string]NewEntryProviderFun
func ScanDirectory ¶
func ScanDirectory(dir string, blacklist map[string]struct{}) (map[string]DesktopFile, error)
func ScanMulti ¶
func ScanMulti(directories []string, blacklist map[string]struct{}) (map[string]DesktopFile, error)
func Serialize ¶
Serialize an entry to a byte slice. NOTE: the then de-serialized entry will be a pointer type. NOTE: the type of the entry MUST be registered beforehand (see RegisterEntryType[T]()).
func SerializeWithOptions ¶
func SetPathProviderSettings ¶
func SetPathProviderSettings(conf *config.Config, settings PathProviderSettings) error
Types ¶
type Application
deprecated
identifier (e.g. "org.gnome.Calendar.desktop") for an application to launch
Deprecated: use DesktopFileProvider for fewer dependencies and issues
func (Application) LaunchInFrontend
deprecated
func (Application) RemoteLaunch
deprecated
func (a Application) RemoteLaunch(options map[string]string) error
Deprecated: use DesktopFileProvider for fewer dependencies and issues
type ApplicationProvider
deprecated
type ApplicationProvider = MapProvider[Application]
Deprecated: use DesktopFileProvider for fewer dependencies and issues
type Command ¶
type Command struct { Name string `json:"name"` Args []string `json:"args"` // how much should we wait before exiting after a successful run SecondDelay int `json:"second_delay"` // failure leave the window open by default CloseOnFailure bool `json:"close_on_failure"` }
command to run in the current terminal
func (Command) LaunchInFrontend ¶
type DesktopFile ¶
func (DesktopFile) LaunchInFrontend ¶
func (DesktopFile) RemoteLaunch ¶
func (d DesktopFile) RemoteLaunch(options map[string]string) error
type DesktopFileProvider ¶
type DesktopFileProvider = MapProvider[DesktopFile]
type Entry ¶
type Entry interface { // LaunchInFrontend launches the entry in the provided frontend LaunchInFrontend(f frontend.Frontend, options map[string]string) error // RemoteLaunch should be used by the remote to launch the entry in a different process RemoteLaunch(options map[string]string) error }
func Deserialize ¶
Return a new entry from the serialization NOTE: the de-serialized entry will be a pointer type. NOTE: the type of the entry MUST be registered beforehand (see RegisterEntryType[T]())
type EntryProvider ¶
type EntryProvider interface { // returns a reader from which all keywords can be read GetEntryReader() (io.Reader, error) // returns a value for an entry Fetch(entry string) (Entry, bool) // whether the provider is independent of the remote IsRemoteIndependent() bool }
func GetProviders ¶
func GetProviders( conf *config.Config, options map[string]string, builders ...NewEntryProviderFun, ) ([]EntryProvider, error)
func NewApplicationProvider
deprecated
func NewCommandProvider ¶
func NewDesktopFileProvider ¶
func NewPathProvider ¶
func NewShortcutProvider ¶
type MapProvider ¶
func (MapProvider[T]) GetEntryReader ¶
func (mp MapProvider[T]) GetEntryReader() (io.Reader, error)
func (MapProvider[T]) IsRemoteIndependent ¶
func (mp MapProvider[T]) IsRemoteIndependent() bool
type NewEntryProviderFun ¶
type PathProvider ¶
type PathProvider struct {
PathProviderSettings
}
provide path on the disk
func (PathProvider) GetEntryReader ¶
func (p PathProvider) GetEntryReader() (io.Reader, error)
func (PathProvider) IsRemoteIndependent ¶
func (p PathProvider) IsRemoteIndependent() bool
type PathProviderSettings ¶
type ShortCut ¶
type ShortCut string
either an URI or an absolute path
func (ShortCut) LaunchInFrontend ¶
type ShortCutProvider ¶
type ShortCutProvider = MapProvider[ShortCut]
provide URIs and path as shortcuts