Skip to content

Commit 76fb5e0

Browse files
clean exit button in Tauri wrapper
1 parent 155e4f3 commit 76fb5e0

9 files changed

Lines changed: 56 additions & 10 deletions

File tree

client/src/components/Dock/components/ActionsDock/ActionsDock.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React, {useRef, useState} from "react";
88
import "./ActionsDock.scss";
99
import {ThemeProvider} from "@mui/material";
1010
import {darkTheme} from "../../../../utils";
11-
import {BinFull, FloppyDiskArrowIn, FloppyDiskArrowOut, Settings as SettingsIcon, HelpCircle as Docs} from "iconoir-react";
11+
import {BinFull, FloppyDiskArrowIn, FloppyDiskArrowOut, Settings as SettingsIcon, HelpCircle as Docs, OffTag} from "iconoir-react";
1212
import {BaseDialog} from "../../../BaseDialog";
1313
import {DockItem} from "../DockItem";
1414
import {Settings} from "./components/Settings";
@@ -41,6 +41,20 @@ export function ActionsDock ({onSave, onLoad, onClear}: WorkflowActionsProps) {
4141
}
4242
};
4343

44+
const handleCloseApp = async () => {
45+
if (isTauri()) {
46+
try {
47+
const {invoke} = await import('@tauri-apps/api/core');
48+
49+
await invoke('kill_backend_process');
50+
51+
const {Window} = await import('@tauri-apps/api/window');
52+
53+
await Window.getCurrent().close();
54+
} catch { /* empty */ }
55+
}
56+
};
57+
4458
return (
4559
<ThemeProvider theme={darkTheme}>
4660
<div className="actions-dock">
@@ -53,6 +67,7 @@ export function ActionsDock ({onSave, onLoad, onClear}: WorkflowActionsProps) {
5367
>
5468
<Settings />
5569
</BaseDialog>
70+
{isTauri() && <DockItem title="Close App" icon={<OffTag />} onClick={handleCloseApp} />}
5671
<DockItem title="Open Documentation" icon={<Docs />} onClick={handleOpenDocs} />
5772
<DockItem title="Save workflow" icon={<FloppyDiskArrowIn />} onClick={onSave} />
5873
<DockItem title="Clear workflow" icon={<BinFull />} onClick={onClear} />

client/src/components/MarkdownRenderer/MarkdownRenderer.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
overflow: hidden;
1212
border-radius: 4px;
1313
border: 1px solid rgba(255, 255, 255, 0.12);
14-
// font-size: 0.9em;
1514
}
1615

1716
thead {

docs/src/components/YouTubePreview/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
}
4444

4545
.youtube-preview-play {
46+
opacity: 0.8;
4647
position: absolute;
4748
top: 50%;
4849
left: 50%;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agentic-signal",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Visual AI Workflow Automation Platform with Local Agent Intelligence",
55
"author": "Code Forge Temple",
66
"type": "module",

src-tauri/capabilities/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"core:default",
1010
"shell:allow-open",
1111
"core:window:allow-set-fullscreen",
12-
"core:window:allow-is-fullscreen"
12+
"core:window:allow-is-fullscreen",
13+
"core:window:allow-close"
1314
]
1415
}

src-tauri/src/main.gen.rs.mustache

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// THIS FILE IS AUTOGENERATED. DO NOT EDIT MANUALLY.
22

3-
use std::process::Command;
3+
use std::process::{Command};
44
use std::env;
55
use std::path::PathBuf;
6+
use std::sync::{Arc, Mutex};
7+
use tauri::{Manager};
68

79
mod utils;
810

@@ -14,7 +16,8 @@ mod nodes;
1416

1517
fn main() {
1618
tauri::Builder::default()
17-
.setup(|_app| {
19+
.manage(crate::utils::manage_process::BackendProcess(Arc::new(Mutex::new(None))))
20+
.setup(|app| {
1821
let exe_dir = env::current_exe()
1922
.ok()
2023
.and_then(|p| p.parent().map(|p| p.to_path_buf()))
@@ -27,13 +30,17 @@ fn main() {
2730
#[cfg(target_os = "macos")]
2831
let backend_path = exe_dir.join("bin").join("agentic-signal-backend-macos");
2932
30-
Command::new(backend_path)
33+
let child = Command::new(backend_path)
3134
.spawn()
3235
.expect("Failed to start backend");
36+
37+
app.state::<crate::utils::manage_process::BackendProcess>().0.lock().unwrap().replace(child);
38+
3339
Ok(())
3440
})
3541
.plugin(tauri_plugin_shell::init())
3642
.invoke_handler(tauri::generate_handler![
43+
crate::utils::manage_process::kill_backend_process,
3744
crate::utils::google_oauth::start_google_oauth_flow,
3845
{{#nodesAndToolsCommands}}
3946
{{.}},
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
use tauri::State;
3+
use std::process::Child;
4+
use std::sync::{Arc, Mutex};
5+
6+
pub struct BackendProcess(pub Arc<Mutex<Option<Child>>>);
7+
8+
#[tauri::command]
9+
pub fn kill_backend_process(state: State<BackendProcess>) -> Result<(), String> {
10+
let mut lock = state.0.lock().unwrap();
11+
12+
if let Some(child) = lock.as_mut() {
13+
child.kill().map_err(|e| e.to_string())?;
14+
15+
lock.take();
16+
17+
Ok(())
18+
} else {
19+
Err("No backend process found".to_string())
20+
}
21+
}

src-tauri/src/utils/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pub mod google_oauth;
2-
pub mod shared_oauth_server;
2+
pub mod shared_oauth_server;
3+
pub mod manage_process;

src-tauri/tauri.conf.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
33
"productName": "agentic-signal",
4-
"version": "2.2.0",
4+
"version": "2.3.0",
55
"identifier": "com.agentic-signal",
66
"build": {
77
"frontendDist": "../client/dist",
@@ -17,7 +17,8 @@
1717
"height": 1080,
1818
"resizable": true,
1919
"fullscreen": false,
20-
"dragDropEnabled": false
20+
"dragDropEnabled": false,
21+
"backgroundColor": "#141414"
2122
}
2223
],
2324
"security": {

0 commit comments

Comments
 (0)