Skip to content

[notification] Interaction buttons do not display text by registerActionTypes #2968

@sufuwang

Description

@sufuwang
import { registerActionTypes, createChannel, sendNotification, onAction } from '@tauri-apps/plugin-notification';

await registerActionTypes([
    {
        id: 's',
        actions: [
            {
                id: 's1',
                title: '11',
            },
        ],
    },
]);
// 创建 channel
await createChannel({
    id: 'messages',
    name: 'Messages',
    description: 'Test message channel',
    importance: 4,
});
onAction(() => {
    notify({
        title: 'XXX 333',
        body: '33333',
    })
})
sendNotification({
    title: 'actions',
    body: '测试11',
    actionTypeId: 's',
    channelId: 'messages'
})

src-tauri/capabilities/default.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": [
    "main"
  ],
  "permissions": [
    "core:default",
    "opener:default",
    "notification:default",
    "notification:allow-request-permission",
    "notification:allow-notify",
    "notification:allow-register-action-types",
    "notification:allow-register-listener"
  ]
}

Two bugs were found

  1. In system notifications, the action button does not display text
  2. when i use onAction function, console happened
2025-09-01 16:37:07.891 16598-16598 Tauri/Console
com.sc.app
E  File: http://tauri.localhost/src/App.vue - Line 155 - Msg: Uncaught (in promise) notification.registerListener not allowed. Command not found
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions