Skip to content

Latest commit

 

History

History
89 lines (82 loc) · 10.7 KB

IPublicAPI.md

File metadata and controls

89 lines (82 loc) · 10.7 KB

IPublicAPI interface

Public APIs that plugin can use

public interface IPublicAPI

Members

name description
event ActualApplicationThemeChanged Invoked when the actual theme of the application has changed. Currently, the plugin will continue to be subscribed even if it is turned off.
event VisibilityChanged Invoked when the visibility of the main window has changed. Currently, the plugin will continue to be subscribed even if it is turned off.
ActionKeywordAssigned(…) Check whether specific ActionKeyword is assigned to any of the plugin
AddActionKeyword(…) Add ActionKeyword and update action keyword metadata for specific plugin. Before adding, please check if action keyword is already assigned by ActionKeywordAssigned
BackToQueryResults() Back to the query results. This method should run when selected item is from context menu or history.
ChangeQuery(…) Change Flow.Launcher query. When current results are from context menu or history, it will go back to query results before changing query.
CheckForNewUpdate() Check for new Flow Launcher update
CopyToClipboard(…) Copies the passed in text and shows a message indicating whether the operation was completed successfully. When directCopy is set to true and passed in text is the path to a file or directory, the actual file/directory will be copied to clipboard. Otherwise the text itself will still be copied to clipboard.
FocusQueryTextBox() Focus the query text box in the main window
FuzzySearch(…) Fuzzy Search the string with the given query. This is the core search mechanism Flow uses
GetAllInitializedPlugins(…) Get all initialized plugins
GetAllPlugins() Get all loaded plugins
GetAvailableThemes() Get all available themes
GetCurrentTheme() Get the current theme
GetDataDirectory() Get the user data directory of Flow Launcher.
GetLogDirectory() Get the log directory of Flow Launcher.
GetPluginManifest() Get the current plugin manifest entries known to Flow Launcher.
GetTranslation(…) Get translation of current language You need to implement IPluginI18n if you want to support multiple languages for your plugin
HideMainWindow() Hide MainWindow
HttpDownloadAsync(…) Download the specific url to a cretain file path
HttpGetStreamAsync(…) Http download the specific url and return as stream
HttpGetStringAsync(…) Http download the specific url and return as string
InstallPlugin(…) Install a plugin. By default will remove the zip file if installation is from url, unless it's a local path installation
IsApplicationDarkTheme() Representing whether the application is using a dark theme
IsGameModeOn() Representing Game Mode status
IsMainWindowVisible() Representing whether the main window is visible
LoadCacheBinaryStorageAsync<T>(…) Load BinaryStorage for current plugin's cache. This is the method used to load cache from binary in Flow. When the file is not exist, it will create a new instance for the specific type.
LoadImageAsync(…) Load image from path. Support local, remote and data:image url. Support png, jpg, jpeg, gif, bmp, tiff, ico, svg image files. If image path is missing, it will return a missing icon.
LoadSettingJsonStorage<T>() Load JsonStorage for current plugin's setting. This is the method used to load settings from json in Flow. When the file is not exist, it will create a new instance for the specific type.
LogDebug(…) Log debug message Message will only be logged in Debug mode
LogError(…) Log error message. Preferred error logging method for plugins.
LogException(…) Log an Exception. Will throw if in debug mode so developer will be aware, otherwise logs the eror message. This is the primary logging method used for Flow
LogInfo(…) Log info message
LogWarn(…) Log warning message
OpenAppUri(…) Opens the application URI with the given Uri object, e.g. obsidian://search-query-example (2 methods)
OpenDirectory(…) Open directory in an explorer configured by user via Flow's Settings. The default is Windows Explorer
OpenSettingDialog() Open setting dialog
OpenUrl(…) Opens the URL with the given Uri object in browser if scheme is Http or Https. If the URL is a local file, it will instead be opened with the default application for that file type. The browser and mode used is based on what's configured in Flow's default browser settings. (2 methods)
OpenWebUrl(…) Opens the URL using the browser with the given Uri object, even if the URL is a local file. The browser and mode used is based on what's configured in Flow's default browser settings. (2 methods)
PluginModified(…) Check if the plugin has been modified. If this plugin is updated, installed or uninstalled and users do not restart the app, it will be marked as modified
RegisterGlobalKeyboardCallback(…) Registers a callback function for global keyboard events.
ReloadAllPluginData() Reloads any Plugins that have the IReloadable implemented. It refeshes Plugin's in memory data with new content added by user.
RemoveActionKeyword(…) Remove ActionKeyword and update action keyword metadata for specific plugin
RemoveGlobalKeyboardCallback(…) Remove a callback for Global Keyboard Event
ReQuery(…) Reloads the query. When current results are from context menu or history, it will go back to query results before re-querying.
RestartApp() Restart Flow Launcher
SaveAppAllSettings() Save everything, all of Flow Launcher and plugins' data and settings
SaveCacheBinaryStorageAsync<T>(…) Save BinaryStorage for current plugin's cache. This is the method used to save cache to binary in Flow. This method will save the original instance loaded with LoadCacheBinaryStorageAsync. This API call is for manually Save. Flow will automatically save all cache type that has called LoadCacheBinaryStorageAsync or SaveCacheBinaryStorageAsync previously.
SavePluginCaches() Save all Flow's plugins caches
SavePluginSettings() Save all Flow's plugins settings
SaveSettingJsonStorage<T>() Save JsonStorage for current plugin's setting. This is the method used to save settings to json in Flow. This method will save the original instance loaded with LoadJsonStorage. This API call is for manually Save. Flow will automatically save all setting type that has called LoadSettingJsonStorage or SaveSettingJsonStorage previously.
SetCurrentTheme(…) Set the current theme
SetGameMode(…) Switches Game Mode to given value
ShellRun(…) Run a shell command
ShowMainWindow() Show the MainWindow when hiding
ShowMsg(…) Show message box (2 methods)
ShowMsgBox(…) Displays a standardised Flow message box.
ShowMsgError(…) Show the error message using Flow's standard error icon.
ShowMsgErrorWithButton(…) Show the error message using Flow's standard error icon.
ShowMsgWithButton(…) Show message box with button (2 methods)
ShowProgressBoxAsync(…) Displays a standardised Flow progress box.
StartLoadingBar() Start the loading bar in main window
StopLoadingBar() Stop the loading bar in main window
StopwatchLogDebug(…) Log debug message of the time taken to execute a method Message will only be logged in Debug mode
StopwatchLogDebugAsync(…) Log debug message of the time taken to execute a method asynchronously Message will only be logged in Debug mode
StopwatchLogInfo(…) Log info message of the time taken to execute a method
StopwatchLogInfoAsync(…) Log info message of the time taken to execute a method asynchronously
ToggleGameMode() Toggles Game Mode. off -> on and backwards
UninstallPluginAsync(…) Uninstall a plugin
UpdatePluginAsync(…) Update a plugin to new version, from a zip file. By default will remove the zip file if update is via url, unless it's a local path installation
UpdatePluginManifestAsync(…) Update the plugin manifest

See Also