I'm new to Tauri and Rust in general.
I'm working on this desktop app that will run different bash commands such as:
- returning some outputs
- open a new window (terminal) to run a process with output value
I'm not entirely sure how to best make it work.
Would somebody has snippet related to bash script in a tauri App ? To get a general idea ?
Something as small echo "hello" or anything else really or even opening an app with osascript.
Anything would be very much appreciated
tauri.conf.json
"tauri": {
"allowlist": {
"all": false,
"shell": {
"all": true,
"execute": true,
"sidecar": true,
"open": true,
"scope": [
{
"name": "test",
"cmd": "echo",
"args": ["hello"]
},
{
"name": "testing",
"cmd": "osascript",
"args": ["-e", "tell application \"Calendar\" to activate"]
}
]
}
main.js
const { Command } = window.__TAURI__.shell
async function greet() {
console.log("call")
new Command('test', ["hello"])
new Command('testing', ["-e", "tell application \"Calendar\" to activate"])
}
I'm also new to this, and just figured it out. Try this:
tauri.config.json
In your js file: