Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ tauri-plugin-dialog = "2.6"
tauri-plugin-fs = "2"
tauri-plugin-log = "2"
tauri-plugin-autostart = "2"
tauri-plugin-notification = "2"
tauri-build = { version = "2", features = [] }

# Windows-specific dependencies
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/apps/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tauri-plugin-dialog = { workspace = true }
tauri-plugin-fs = { workspace = true }
tauri-plugin-log = { workspace = true }
tauri-plugin-autostart = { workspace = true }
tauri-plugin-notification = { workspace = true }

# Inherited from workspace
tokio = { workspace = true }
Expand Down
11 changes: 9 additions & 2 deletions src/apps/desktop/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,17 @@
]
},
{
"identifier": "fs:allow-home-write-recursive",
"identifier": "fs:allow-home-write-recursive",
"allow": [
{ "path": "$HOME/**" }
]
}
},
"notification:default",
"notification:allow-notify",
"notification:allow-show",
"notification:allow-request-permission",
"notification:allow-check-permissions",
"notification:allow-permission-state",
"notification:allow-is-permission-granted"
]
}
22 changes: 22 additions & 0 deletions src/apps/desktop/src/api/system_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,25 @@ pub async fn set_macos_edit_menu_mode(

Ok(())
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SendNotificationRequest {
pub title: String,
pub body: Option<String>,
}

/// Send an OS-level desktop notification (Windows toast / macOS notification center).
#[tauri::command]
pub async fn send_system_notification(
app: tauri::AppHandle,
request: SendNotificationRequest,
) -> Result<(), String> {
use tauri_plugin_notification::NotificationExt;

let mut builder = app.notification().builder().title(&request.title);
if let Some(body) = &request.body {
builder = builder.body(body);
}
builder.show().map_err(|e| e.to_string())
}
2 changes: 2 additions & 0 deletions src/apps/desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub async fn run() {
.app_name("BitFun")
.build(),
)
.plugin(tauri_plugin_notification::init())
.manage(app_state)
.manage(coordinator_state)
.manage(scheduler_state)
Expand Down Expand Up @@ -586,6 +587,7 @@ pub async fn run() {
api::terminal_api::terminal_shutdown_all,
api::terminal_api::terminal_get_history,
get_system_info,
send_system_notification,
check_command_exists,
check_commands_exist,
run_system_command,
Expand Down
5 changes: 5 additions & 0 deletions src/crates/core/src/service/config/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ pub struct NotificationConfig {
pub enabled: bool,
pub position: String,
pub duration: u32,
/// Whether to show a toast notification when a dialog turn completes while the window is not focused.
#[serde(default = "default_true")]
pub dialog_completion_notify: bool,
}

/// Theme configuration.
Expand Down Expand Up @@ -932,6 +935,7 @@ impl Default for AppConfig {
enabled: true,
position: "topRight".to_string(),
duration: 5000,
dialog_completion_notify: true,
},
session_config: AppSessionConfig::default(),
ai_experience: AIExperienceConfig::default(),
Expand Down Expand Up @@ -1235,6 +1239,7 @@ impl Default for NotificationConfig {
enabled: true,
position: "topRight".to_string(),
duration: 5000,
dialog_completion_notify: true,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@tauri-apps/plugin-dialog": "^2.6.0",
"@tauri-apps/plugin-fs": "^2.0.0",
"@tauri-apps/plugin-log": "^2.8.0",
"@tauri-apps/plugin-notification": "^2.3.3",
"@tauri-apps/plugin-opener": "^2.5.2",
"@tiptap/core": "^3.20.4",
"@tiptap/extension-details": "^3.20.4",
Expand Down
Binary file modified src/web-ui/public/Logo-ICON.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading