plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

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

Open naman-crabnebula opened this issue 1 year ago • 1 comments

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.

naman-crabnebula avatar Mar 18 '24 14:03 naman-crabnebula

Javascript notification API also does not work in Linux mint Cinnamon

almahdi404 avatar May 02 '24 13:05 almahdi404

notification not work on MacOS too

zero9527 avatar Oct 12 '24 08:10 zero9527

Running into this as well (notification sounds and all) on Linux Mint. Some additional info that's hopefully helpful!

Cargo Tauri Info
[✔] Environment
    - OS: Linux Mint 22.1.0 x86_64 (X64) (cinnamon on x11)
    ✔ webkit2gtk-4.1: 2.46.5
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.84.1 (e71f9a9a9 2025-01-27)
    ✔ cargo: 1.84.1 (66221abde 2024-11-19)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 23.7.0
    - pnpm: 9.15.4
    - npm: 10.9.2
    - bun: 1.2.1

[-] Packages
    - tauri 🦀: 2.2.5
    - tauri-build 🦀: 2.0.5
    - wry 🦀: 0.48.1
    - tao 🦀: 0.31.1
    - @tauri-apps/api : 2.2.0
    - @tauri-apps/cli : 2.2.7

[-] Plugins
    - tauri-plugin-opener 🦀: 2.2.5
    - @tauri-apps/plugin-opener : 2.2.5
    - tauri-plugin-notification 🦀: 2.2.1
    - @tauri-apps/plugin-notification : 2.2.1
    - tauri-plugin-log 🦀: 2.2.1
    - @tauri-apps/plugin-log : 2.2.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Code Snippet

#[tauri::command]
fn notify(app_handle: tauri::AppHandle) {
    use tauri_plugin_notification::NotificationExt;
    log::info!("Tauri is awesome!");
    app_handle
        .notification()
        .builder()
        .title("Tauri")
        .body("Tauri is awesome")
        .show()
        .unwrap();
}

RyKilleen avatar Feb 06 '25 19:02 RyKilleen