Module desktopfile.utils

Utility functions for reading and executing desktop files.

See Also

Desktop Entry Specification

Functions

NameDescription
desktopId(fileName, appsPaths) See Desktop File ID
desktopId(fileName) See Desktop File ID
expandExecArgs(unquotedArgs, urls, iconName, displayName, fileName) Expand Exec arguments (usually returned by unquoteExec) replacing field codes with given values, making the array suitable for passing to spawnProcess. Deprecated field codes are ignored.
findDesktopFile(desktopId, appsPaths) Find desktop file by Desktop File ID. Desktop file ID can be ambiguous when it has hyphen symbol, so this function can try both variants.
findDesktopFile(desktopId) ditto
fireDesktopFile(reader, fileName, options) Read the desktop file and run application or open link depending on the type of the given desktop file.
fireDesktopFile(fileName, options) ditto, but automatically create IniLikeReader from the file.
getTerminalCommand() Detect command which will run program in terminal emulator. It tries to detect your desktop environment and find default terminal emulator for it. If all guesses failed, it uses ["xterm", "-e"] as fallback.
isTrusted(appFileName) Check if .desktop file is trusted.
needMultipleInstances(execArgs) Check if application should be started multiple times to open multiple urls.
paramSupport(execArgs) Evaluate ParamSupport flags for application Exec command.
spawnApplication(unquotedArgs, params) Spawn application with given params.
unquoteExec(unescapedValue) Apply unquoting to Exec value making it into an array of escaped arguments. It automatically performs quote-related unescaping.

Classes

NameDescription
DesktopExecException Exception thrown when "Exec" value of DesktopFile or DesktopAction is invalid.

Structs

NameDescription
ExecBuilder Helper struct to build Exec string for desktop file.
FireOptions Options to pass to fireDesktopFile.
SpawnParams Parameters for spawnApplication.

Enums

NameDescription
ParamSupport Flag set of parameter kinds supported by application. Having more than one flag means that Exec command is ambiguous.