Skip to content

Commit eb03ce1

Browse files
authored
Merge pull request #255 from GCWing/gcwing/dev
feat: assistant scene, nav/shell refresh, desktop notifications
2 parents 98d936e + 350b7d8 commit eb03ce1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3588
-2323
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ tauri-plugin-dialog = "2.6"
105105
tauri-plugin-fs = "2"
106106
tauri-plugin-log = "2"
107107
tauri-plugin-autostart = "2"
108+
tauri-plugin-notification = "2"
108109
tauri-build = { version = "2", features = [] }
109110

110111
# Windows-specific dependencies

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/apps/desktop/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tauri-plugin-dialog = { workspace = true }
2929
tauri-plugin-fs = { workspace = true }
3030
tauri-plugin-log = { workspace = true }
3131
tauri-plugin-autostart = { workspace = true }
32+
tauri-plugin-notification = { workspace = true }
3233

3334
# Inherited from workspace
3435
tokio = { workspace = true }

src/apps/desktop/capabilities/default.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@
9393
]
9494
},
9595
{
96-
"identifier": "fs:allow-home-write-recursive",
96+
"identifier": "fs:allow-home-write-recursive",
9797
"allow": [
9898
{ "path": "$HOME/**" }
9999
]
100-
}
100+
},
101+
"notification:default",
102+
"notification:allow-notify",
103+
"notification:allow-show",
104+
"notification:allow-request-permission",
105+
"notification:allow-check-permissions",
106+
"notification:allow-permission-state",
107+
"notification:allow-is-permission-granted"
101108
]
102109
}

src/apps/desktop/src/api/system_api.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,25 @@ pub async fn set_macos_edit_menu_mode(
166166

167167
Ok(())
168168
}
169+
170+
#[derive(Debug, Serialize, Deserialize)]
171+
#[serde(rename_all = "camelCase")]
172+
pub struct SendNotificationRequest {
173+
pub title: String,
174+
pub body: Option<String>,
175+
}
176+
177+
/// Send an OS-level desktop notification (Windows toast / macOS notification center).
178+
#[tauri::command]
179+
pub async fn send_system_notification(
180+
app: tauri::AppHandle,
181+
request: SendNotificationRequest,
182+
) -> Result<(), String> {
183+
use tauri_plugin_notification::NotificationExt;
184+
185+
let mut builder = app.notification().builder().title(&request.title);
186+
if let Some(body) = &request.body {
187+
builder = builder.body(body);
188+
}
189+
builder.show().map_err(|e| e.to_string())
190+
}

src/apps/desktop/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ pub async fn run() {
141141
.app_name("BitFun")
142142
.build(),
143143
)
144+
.plugin(tauri_plugin_notification::init())
144145
.manage(app_state)
145146
.manage(coordinator_state)
146147
.manage(scheduler_state)
@@ -586,6 +587,7 @@ pub async fn run() {
586587
api::terminal_api::terminal_shutdown_all,
587588
api::terminal_api::terminal_get_history,
588589
get_system_info,
590+
send_system_notification,
589591
check_command_exists,
590592
check_commands_exist,
591593
run_system_command,

src/crates/core/src/service/config/types.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ pub struct NotificationConfig {
9999
pub enabled: bool,
100100
pub position: String,
101101
pub duration: u32,
102+
/// Whether to show a toast notification when a dialog turn completes while the window is not focused.
103+
#[serde(default = "default_true")]
104+
pub dialog_completion_notify: bool,
102105
}
103106

104107
/// Theme configuration.
@@ -932,6 +935,7 @@ impl Default for AppConfig {
932935
enabled: true,
933936
position: "topRight".to_string(),
934937
duration: 5000,
938+
dialog_completion_notify: true,
935939
},
936940
session_config: AppSessionConfig::default(),
937941
ai_experience: AIExperienceConfig::default(),
@@ -1235,6 +1239,7 @@ impl Default for NotificationConfig {
12351239
enabled: true,
12361240
position: "topRight".to_string(),
12371241
duration: 5000,
1242+
dialog_completion_notify: true,
12381243
}
12391244
}
12401245
}

src/web-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@tauri-apps/plugin-dialog": "^2.6.0",
2222
"@tauri-apps/plugin-fs": "^2.0.0",
2323
"@tauri-apps/plugin-log": "^2.8.0",
24+
"@tauri-apps/plugin-notification": "^2.3.3",
2425
"@tauri-apps/plugin-opener": "^2.5.2",
2526
"@tiptap/core": "^3.20.4",
2627
"@tiptap/extension-details": "^3.20.4",

0 commit comments

Comments
 (0)