| Crates.io | tauri-plugin-widget |
| lib.rs | tauri-plugin-widget |
| version | 0.1.2 |
| created_at | 2025-09-28 13:37:44.634281+00 |
| updated_at | 2025-09-29 05:49:02.418623+00 |
| description | A Tauri plugin to interact with App Widgets (Android). Allows your Tauri app to shared preferences (Android), and update timeline widgets. |
| homepage | |
| repository | https://github.com/fwy13/tauri-plugin-widget |
| max_upload_size | |
| id | 1858335 |
| size | 172,589 |
A Tauri plugin to interact with App Widgets (Android). Allows your Tauri app to shared preferences (Android), and update timeline widgets.
[!NOTE]
Thanks for the idea from https://github.com/kisimediaDE/capacitor-widget-bridge
[dependencies]
tauri-plugin-widget = "0.1.2"
npm install tauri-plugin-widget-api
src-tauri/lib.rspub fn run() {
tauri::Builder::default()
// Register here.
.plugin(tauri_plugin_widget::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
ui (react, svelte, vue, ...)import {
setItems,
getItems,
setRegisterWidget,
reloadTimelines,
requestWidget,
} from "tauri-plugin-widget-api";
[!IMPORTANT]
You always set register the widget classes in JS code await setRegisterWidget(["com.example.widgetbrideexample.MyWidget"]);
setItems(key: string, value: string, group: string): Promise<DataResult<boolean>>Stores a key-value pair in the widget storage under a specific group.
Returns:
Promise<DataResult<boolean>> – true if the item was stored successfully.
getItems(key: string, group: string): Promise<DataResult<any>>Retrieves a value from the widget storage based on key and group.
Returns:
Promise<DataResult<any>> – The stored value (any type) or null if not found.
reloadAllTimelines(): Promise<DataResult<boolean>>Requests the system to reload all widget timelines (refreshes every registered widget).
Returns:
Promise<DataResult<boolean>> – true if the reload was successful.
reloadTimelines(ofKind: string): Promise<DataResult<boolean>>Requests the system to reload timelines of a specific kind of widget.
Returns:
Promise<DataResult<boolean>> – true if the reload was successful.
setRegisterWidget(widgets: string[]): Promise<DataResult<boolean>>Registers a list of widgets that the application will manage.
Returns:
Promise<DataResult<boolean>> – true if registration was successful.
requestWidget(): Promise<DataResult<boolean>>Requests the system to provide or display the registered widget.
(Useful for triggering the widget add flow on the home screen).
Returns:
Promise<DataResult<boolean>> – true if the request was successful.
MIT