Notifications

Methods

Create Notification

Creates a new notification.

await window.deskifier.notifications.create({ arguments })

Arguments

  • title String (Required)
    A title for the notification, which will be displayed at the top of the notification window when it is shown.

  • body String (Required)
    The body text of the notification, which will be displayed below the title or subtitle.

  • subtitle String macOS (Optional)

    A subtitle for the notification, which will be displayed below the title.

  • silent Boolean (Optional)
    Whether or not to suppress the OS notification noise when showing the notification.

  • iconDataURL String (Optional)
    A data URL for a custom notification icon.

  • hasReply Boolean macOS (Optional)

    Whether or not to add an inline reply option to the notification.

  • timeoutType String Linux Windows (Optional)

    The timeout duration of the notification. Can be default or never.

  • replyPlaceholder String macOS (Optional)

    The placeholder to write in the inline reply input field.

  • closeButtonText String macOS (Optional)
    A custom title for the close button of an alert. An empty string will cause the default localized text to be used.

  • toastXml String Windows (Optional)

    A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.

  • notificationId String (Optional)

    An identifier for the notification. If left empty, an ID will be generated.

Returns

  • success Boolean
    If the action was successful.
  • message String
    Additional confirmation, or error details if action was unsuccessful.
  • notificationId String
    The given or generated notification ID.

Example

const notificationOptions = {
    title: "Hello!",
    body: "This is a notification example.",
    silent: true
};

const result = await window.deskifier.notifications.create(notificationOptions);

console.log(result.success) //true

Set Badge Count

Sets the counter badge for current app. Setting the count to 0 will hide the badge.

await window.deskifier.notifications.setBadgeCount({ arguments })

Arguments

  • count Number (Required)

Returns

  • success Boolean
    If the action was successful.
  • message String
    Additional confirmation, or error details if action was unsuccessful.

Flash Frame

Starts or stops flashing the window in the taskbar to attract user's attention.

On macOS, this causes the application icon to "bounce". Additionally, on macOS, this action only works if the window isn't currently focused.

await window.deskifier.notifications.flashFrame({ arguments })

Arguments

  • flash Boolean (Required)
  • windowId String (Optional)
    Defaults to the current window.

Returns

  • success Boolean
    If the action was successful.
  • message String
    Additional confirmation, or error details if action was unsuccessful.

Events

Notification Clicked

Fires when the notification is clicked by the user.

window.deskifier.notifications.onClicked((data) => { })

Arguments

  • notificationId String
    The given or generated notification ID.

Notification Reply

macOS Fires when the user types a reply in the notification.

window.deskifier.notifications.onReply((data) => { })

Arguments

  • notificationId String
    The given or generated notification ID.
  • reply String
    The user reply.