This Extension adds methods to the global plasmoid object that allow launching applications, running commands and opening files and urls.
- bool runApplication(string application[, array files])
Runs an application by name (can reference an installed .desktop file as well as an executable in the user's $PATH) with an optional array of files. The file array may contain either Urls or strings. Returns true on success, false on failure.
- bool runCommand(string exe[, array args])
Runs the executable with the given arguments. Returns true on success, false on failure. For example:
plasmoid.runCommand("xmessage", ["hi"]); // is same as running "xmessage hi" on the terminal
- bool openUrl([string|Url] url):
Opens the url in the default application (or asks the user if there is no default application for the file). The url parameter may be either a string or a Url. Returns true on success, false on failure.
- boolean applicationExists(String name): (scripting version >= 4) searches $PATH first, then tries in the application menu system by application storage name (aka the .desktop file name), then Name= entries for apps with installed .desktop files, then GenericName= entries for same
- mixed defaultApplication(String kind [, boolean storageId = false]): (scripting version >= 4) returns the executable (or if storageId is true, then the app menu system id, e.g. its .desktop file name) of the default app. The "kind" parameter may be a well-known application type including "browser", "mailer", "filemanager", "terminal", "imClient" and "windowmanager" (or any other entry in share/apps/kcm_componentchooser/kcm_*.desktop); it may also be a mimetype (e.g. "application/pdf"). On failure, it returns false.
- String applicationPath(String name): (scripting version >= 4) returns the full local path to a given application or .desktop file if it exists.
This page was last modified on 13 November 2011, at 14:02. This page has been accessed 1,825 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.