tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
758 stars 205 forks source link

[bug][notification] Notification do not show up in Linux Cinnamon DE #1089

Open naman-crabnebula opened 3 months ago

naman-crabnebula commented 3 months ago

Hi there, using latest Tauri Plugin Notification, the notification do not show up using app_handle.notification()

Complete discussion :

https://discordapp.com/channels/616186924390023171/1218338813940596867

Brief Summary:

Using the below code snippet, the notification does not show up in Cinnamon Desktop Environment. However, the notification sound can be heard. I am using Cinnamon right now, and am testing other DE as well. Also, using notification on App instead of AppHandle does show the notification.

Cargo Tauri Info

[✔] Environment
    - OS: Garuda Linux Soaring X64
    ✔ webkit2gtk-4.1: 2.42.5
    ✔ rsvg2: 2.57.2
    ✔ rustc: 1.78.0-nightly (0ecbd0605 2024-02-25)
    ✔ cargo: 1.78.0-nightly (194a60b29 2024-02-21)
    ✔ rustup: 1.27.0 (2024-03-12)
    ✔ Rust toolchain: nightly-2024-02-26-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 21.7.0
    - pnpm: 8.15.2
    - yarn: 1.22.21
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.11
    - tauri-build [RUST]: 2.0.0-beta.9
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - tauri-cli [RUST]: 2.0.0-beta.6
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../src

Code Snippet

use tauri_plugin_notification::NotificationExt;

// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(app_handle: tauri::AppHandle, name: &str) -> String {

    if let Err(e) = app_handle.notification().builder().body("body").title("title").show() {
        println!("failed to show notification: {:?}", e);
    }

    format!("Hello, {}! You've been greeted from Rust!", name)
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    let app = tauri::Builder::default()
        .plugin(tauri_plugin_notification::init())
        .plugin(tauri_plugin_shell::init())
        .invoke_handler(tauri::generate_handler![greet])
        .build(tauri::generate_context!())
        .expect("error while running tauri application");

    app.run(|_app_handle, _run_event| {});
}

Edit: There is no issue on Gnome Desktop Environment. So, we can safely assume that this bug is present only on Cinnamon Desktops.

almahdi404 commented 2 months ago

Javascript notification API also does not work in Linux mint Cinnamon