#tauri-plugin #shell #command-line-interface #js #xterm #tauri-pty

sys tauri-plugin-pty

Pseudo Terminal (PTY) plugin for Tauri

7 releases

0.1.0 Mar 10, 2025
0.0.8 Dec 24, 2023

#976 in GUI

Download history 2/week @ 2024-12-09 381/week @ 2025-03-10 278/week @ 2025-03-17

659 downloads per month

MIT license

52KB
602 lines

Tauri Plugin Pseudo Terminal

Developing! Wellcome to contribute!

Example

Full example at: https://github.com/Tnze/tauri-plugin-pty/tree/main/examples/vanilla

# Install this plugin in your Cargo.toml
cargo add tauri-plugin-pty
# Install the api package
npm install tauri-pty
tauri::Builder::default()
    .plugin(tauri_plugin_pty::init()) // add this
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
...
import { Terminal } from "xterm"
import { spawn } from "tauri-pty";

// init xterm.js
const term = new Terminal();
term.open(/* DOM Elem */);
// spawn shell
const pty = spawn("powershell.exe", [/* args */], {
    cols: term.cols,
    rows: term.rows,
})
// transport data
pty.onData(data => term.write(data))
term.onData(data => pty.write(data))

Dependencies

~20–55MB
~889K SLoC