Bindings to the Tauri API for projects using wasm-bindgen

Overview

tauri-sys

Raw bindings to the Tauri API for projects using wasm-bindgen

Installation

This crate is not yet published to crates.io, so you need to use it from git. You also need a global installation of esbuild.

tauri-sys = { git = "https://github.com/JonasKruckenberg/tauri-sys" }

Usage

use serde::{Deserialize, Serialize};
use tauri_sys::tauri;

#[derive(Serialize, Deserialize)]
struct GreetArgs<'a> {
    name: &'a str,
}

fn main() {
    wasm_bindgen_futures::spawn_local(async move {
        let new_msg: String = tauri::invoke("greet", &GreetArgs { name: &name.get() }).await.unwrap();

        println!("{}", new_msg);
    });
}

Features

All modules are gated by accordingly named Cargo features. It is recommended you keep this synced with the features enabled in your Tauri Allowlist but no automated tool for this exists (yet).

  • all: Enables all modules.
  • app: Enables the app module.
  • clipboard: Enables the clipboard module.
  • event: Enables the event module.
  • mocks: Enables the mocks module.
  • tauri: Enables the tauri module.

Are we Tauri yet?

These API bindings are not completely on-par with @tauri-apps/api yet, but here is the current status-quo:

  • app
  • cli
  • clipboard
  • dialog
  • event
  • fs
  • global_shortcut
  • http
  • mocks
  • notification
  • os
  • path
  • process
  • shell
  • tauri
  • updater
  • window

The current API also very closely mirrors the JS API even though that might not be the most ergonomic choice, ideas for improving the API with quality-of-life features beyond the regular JS API interface are very welcome.

You might also like...
Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps.

rust-yew-axum-tauri-desktop template Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps. Crates frontend: Yew frontend app for de

🦀 Small Tauri SolidJS Example feat. Vite
🦀 Small Tauri SolidJS Example feat. Vite

Tauri Solid Example (2022) Simple Solid(vite) starter running with Tauri. Should hopefully save some time trying to setup Tauri and Solid. Currently c

Tauri and Leptos example.

tauri-leptos-example Tauri Leptos Requires Rust Nightly. See Leptos nightly Note. # Install Tauri CLI cargo install tauri-cli # Build and develop for

 A cross-platform tauri gui where Oblique Strategies meets Pomodoro
A cross-platform tauri gui where Oblique Strategies meets Pomodoro

Obliqoro Oblique Strategies meets Pomodoro Built in Rust, Vue3, and Typescript, using Tauri, and SQLite Screenshots About Obliqoro is an open source,

Web-wrapped Supabase desktop app for macOS, Windows & Linux powered by Tauri
Web-wrapped Supabase desktop app for macOS, Windows & Linux powered by Tauri

Supabase Desktop App What is it? It's a cross-platform web-wrapped Supabase desktop app powered by Tauri. You can install it on your macOS, Windows (u

SimpleX Chat GUI built with Rust, Tauri and Yew
SimpleX Chat GUI built with Rust, Tauri and Yew

simplex-desktop A desktop application for simplex-chat. WIP, contributions are welcome. Architecture For the back end we rust with tauri and frontend

A lightweight new Bing (AI chat) desktop application which based on Tauri.

Bing Lite A lightweight new Bing (AI chat) desktop application which based on Tauri. No more Microsoft Edge, no more Chromium/Electron! Download The l

🥃 A plugin for swizzling Tauri’s NSWindow to NSPanel

Swizzle Tauri's NSWindow to NSPanel Install There are three general methods of installation that we can recommend. Use crates.io and npm (easiest, and

A Tauri-based spreadsheet
A Tauri-based spreadsheet

Pulsars A Tauri-based spreadsheet The following cool libraries made it possible to build Pulsars 🚀 : fortune-sheet: TypeScript library for the spread

Comments
  • Should `Builder` methods return `self`?

    Should `Builder` methods return `self`?

    In thinking about the ergonomics of the library, would it be nice for Builder methods -- e.g. FileDialogBuilder.set_default_path -- to return self?

    This would allow method chaining turning, e.g.

    let mut dialog = FileDialogBuilder::new();
    dialog.set_title("Pick a file");
    let file = dialog.pick_file().await;
    

    into

    let file = FileDialogBuilder::new()
        .set_title("Pick a file")
        .pick_file()
        .await;
    
    opened by bicarlsen 4
  • Added `dialog` module features.

    Added `dialog` module features.

    Added dialog module features. I briefly hand tested the functions and everything seems to be working well.

    I split the open method into two: open for single files, and open_multiple for multiple files. This seemed more ergonomic than shoving everything into a single function.

    opened by bicarlsen 3
  • wip: updater

    wip: updater

    (This branch might've been a little messed up due to my merge) This is how far I got with the updater module. Unfortunately my lack of Rust skills and lack of time caused me to not be able to make much progress.

    I hope this still helps a little :D

    opened by mxcop 0
  • Help with `event::listener`

    Help with `event::listener`

    I am trying to use event::listener to react to events coming from the tauri backend in the frontend, but am having trouble actually consuming the result of event::listen.

    Would it be possible to provide a more in-depth example or explanation than the one provided in the docs to help me understand how to use it?

    opened by bicarlsen 1
Owner
Jonas Kruckenberg
Building smaller, faster and secure galaxies with a web frontend
Jonas Kruckenberg
Type-safe IPC for Tauri using GraphQL

Tauri Plugin graphql A plugin for Tauri that enables type-safe IPC through GraphQL. Install Rust [dependencies] tauri-plugin-graphql = "0.2" JavaScrip

Jonas Kruckenberg 40 Dec 29, 2022
A Raycast/Spotlight like app shell using tauri

Tauri Shell This repo can be used as reference for building alfred/raycast/spotlight apps using Tauri. Usage This reference repository is using Svelte

Shivaprasad Bhat 6 Oct 27, 2022
OpenAI ChatGPT desktop app for Mac, Windows, & Linux menubar using Tauri & Rust

ChatGPT Desktop App Unofficial open source OpenAI ChatGPT desktop app for mac, windows, and linux menubar using tauri & rust. Downloads Windows (2.7 M

Sonny Lazuardi 732 Jan 5, 2023
Graceful shutdown util for Rust projects using the Tokio Async runtime.

Shutdown management for graceful shutdown of tokio applications. Guard creating and usage is lock-free and the crate only locks when: the shutdown sig

Plabayo 54 Sep 29, 2023
Cross-platform Window library in Rust for Tauri. [WIP]

Cross-platform application window creation library in Rust that supports all major platforms like Windows, macOS, Linux, iOS and Android. Built for you, maintained for Tauri.

Tauri 899 Jan 1, 2023
Hydrogen is the desktop application for Geplauder, built with tauri studio.

Hydrogen Hydrogen is the desktop application for Geplauder, built with tauri studio. For more information on Geplauder, click here. Usage To configure

null 4 Nov 21, 2021
Helps positioning your tauri windows.

Tauri plugin positioner A plugin for tauri that helps positioning you windows at well known locations. Install Rust [dependencies] tauri-plugin-positi

Jonas Kruckenberg 42 Jan 5, 2023
A custom invoke system for Tauri that leverages a localhost server

Tauri Invoke HTTP This is a crate that provides a custom invoke system for Tauri using a localhost server. Each message is delivered through a XMLHttp

Tauri 17 Dec 17, 2022
This is a small demo to accompany the Tauri + Yew tutorial

Tauri + Yew Demo This is a small demo to accompany the Tauri + Yew tutorial

Steve Pryde 94 Jan 2, 2023
📦 Port of tauri-bundler

?? Port of tauri-bundler You can now easily create installers for your Deno apps, thanks to the amazing work of Tauri ??

Marc Espín 28 Dec 7, 2022