Skip to content

Commit eaa4f39

Browse files
committed
os notifications + delay window showing
1 parent 9a5cf69 commit eaa4f39

File tree

7 files changed

+203
-32
lines changed

7 files changed

+203
-32
lines changed

Cargo.lock

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

apps/desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ tauri-plugin-process = "2.0.0"
3030
tauri-plugin-decorum = "1.0.0"
3131
tauri-plugin-dialog = "2.0.0"
3232
tauri-plugin-updater = "2.0.0"
33+
tauri-plugin-notification = "2.0.0"
3334
tauri-plugin-oauth = { git = "https://github.com/FabianLars/tauri-plugin-oauth", branch = "v2" }
3435
tauri-plugin-global-shortcut = "2.0.0"
3536
tauri-specta = { version = "=2.0.0-rc.20", features = ["derive", "typescript"] }

apps/desktop/src-tauri/src/lib.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use std::{
5555
};
5656
use tauri::{AppHandle, Manager, Runtime, State, WindowEvent};
5757
use tauri_nspanel::ManagerExt;
58+
use tauri_plugin_notification::NotificationExt;
5859
use tauri_plugin_shell::ShellExt;
5960
use tauri_specta::Event;
6061
use tokio::task;
@@ -360,6 +361,10 @@ async fn start_recording(app: AppHandle, state: MutableState<'_, App>) -> Result
360361
if let Some(window) = (CapWindow::InProgressRecording { position: None }).get(&app) {
361362
window.eval("window.location.reload()").unwrap();
362363
window.show().unwrap();
364+
} else {
365+
CapWindow::InProgressRecording { position: None }
366+
.show(&app)
367+
.ok();
363368
}
364369

365370
AppSounds::StartRecording.play();
@@ -1470,16 +1475,16 @@ async fn remove_fake_window(
14701475
Ok(())
14711476
}
14721477

1473-
#[tauri::command(async)]
1474-
#[specta::specta]
1475-
fn show_notifications_window(app: AppHandle) {
1476-
if app.get_webview_window("notifications").is_some() {
1477-
println!("notifications window already exists");
1478-
return;
1479-
}
1478+
// #[tauri::command(async)]
1479+
// #[specta::specta]
1480+
// fn show_notifications_window(app: AppHandle) {
1481+
// if app.get_webview_window("notifications").is_some() {
1482+
// println!("notifications window already exists");
1483+
// return;
1484+
// }
14801485

1481-
CapWindow::Notifications.show(&app).unwrap();
1482-
}
1486+
// CapWindow::Notifications.show(&app).unwrap();
1487+
// }
14831488

14841489
#[tauri::command(async)]
14851490
#[specta::specta]
@@ -2345,7 +2350,7 @@ pub async fn run() {
23452350
list_capture_screens,
23462351
list_audio_devices,
23472352
show_previous_recordings_window,
2348-
show_notifications_window,
2353+
// show_notifications_window,
23492354
close_previous_recordings_window,
23502355
set_fake_window_bounds,
23512356
remove_fake_window,
@@ -2437,6 +2442,7 @@ pub async fn run() {
24372442
.plugin(tauri_plugin_oauth::init())
24382443
.plugin(tauri_plugin_http::init())
24392444
.plugin(tauri_plugin_updater::Builder::new().build())
2445+
.plugin(tauri_plugin_notification::init())
24402446
.plugin(flags::plugin::init())
24412447
.invoke_handler(specta_builder.invoke_handler())
24422448
.setup(move |app| {
@@ -2552,12 +2558,6 @@ pub async fn run() {
25522558
});
25532559
});
25542560

2555-
let app_handle_clone = app_handle.clone();
2556-
tauri::async_runtime::spawn(async move {
2557-
tokio::time::sleep(Duration::from_secs(5)).await;
2558-
AuthenticationInvalid.emit(&app_handle_clone).ok();
2559-
});
2560-
25612561
let app_handle_clone = app_handle.clone();
25622562
AuthenticationInvalid::listen_any(app, move |_| {
25632563
let app_handle = app_handle_clone.clone();

0 commit comments

Comments
 (0)