LinuxCommandLibrary

dunstctl

Control and manage Dunst notifications

TLDR

Pause/Unpause/Toggle desktop notifications

$ dunstctl set-paused [true|false|toggle]
copy

Close all notifications
$ dunstctl close-all
copy

Delete all notifications from history
$ dunstctl history-clear
copy

Display the latest notification from history
$ dunstctl history-pop
copy

Reload the configuration file
$ dunstctl reload
copy

Display help
$ dunstctl [[-h|--help]]
copy

SYNOPSIS

dunstctl [--json] COMMAND [ARGUMENTS]
dunstctl help

PARAMETERS

history
    Displays the notification history. Can be combined with --json for structured output.

close
    Closes the currently displayed notification.

close-all
    Closes all currently displayed notifications.

dismiss
    Dismisses the oldest notification from the history, marking it as viewed.

action <index> <name>
    Invokes a specific action by its name on a notification identified by its index in the displayed list or history.

is-paused
    Checks if the dunst daemon is currently paused. Returns 'true' or 'false'.

set-paused <true|false>
    Pauses or unpauses the dunst notification daemon, preventing or allowing new notifications to be displayed.

count [displayed|waiting|history]
    Counts notifications by their state: displayed (currently visible), waiting (in queue), or in history.

debug
    Dumps extensive internal debug information from the dunst daemon, useful for troubleshooting.

rule <name> <key> <value>
    Dynamically adds or modifies a notification rule by its name, setting a specific key to a given value.

help
    Displays dunstctl's usage information and a list of available commands.

version
    Shows the version of dunstctl and the connected dunst daemon.

--json
    Global option. Outputs command results in JSON format for commands that support it (e.g., history, count).

DESCRIPTION

dunstctl is a command-line utility used to interact with a running instance of the dunst notification daemon. It provides a programmatic interface to manage notifications, allowing users to close, dismiss, view history, or dynamically set rules for notifications without needing to interact with the graphical notification pop-ups directly.

This is particularly useful for scripting, keyboard shortcuts, or integrating with other desktop tools. dunstctl communicates with dunst via a Unix domain socket, making it efficient and responsive. It's an essential companion for users who rely on dunst for their desktop notifications and desire fine-grained control over them, allowing for complex automation and management workflows.

CAVEATS

caveats: dunstctl requires a running dunst daemon to connect to; it cannot start dunst.
Communication relies on a Unix domain socket, typically located at /tmp/dunstsock, which must be accessible.
Dynamic rules set via dunstctl rule are temporary and are not persistent across dunst daemon restarts. They only affect the current session.
Operations are performed on the live dunst instance, not on its configuration file.

COMMUNICATION MECHANISM

dunstctl communicates with the dunst daemon via a Unix domain socket. This method ensures efficient and secure inter-process communication on the local system. The socket path is typically configured by dunst itself, making connection seamless for dunstctl.

SCRIPTING AND AUTOMATION

Due to its clear command-line interface and the availability of the --json output option, dunstctl is exceptionally well-suited for scripting. It allows users to automate notification management tasks, integrate notification information into status bars (e.g., polybar, i3status), or create custom keyboard shortcuts for quick control over notifications.

HISTORY

dunstctl was introduced as the official command-line control utility for the dunst notification daemon. dunst itself was created to be a lightweight, highly customizable, and dependency-free notification daemon, primarily for tiling window managers where fine-grained control is paramount. The development of dunstctl reflects the project's commitment to providing users with robust programmatic interaction capabilities, enhancing dunst's utility beyond just displaying pop-ups by enabling advanced automation, scripting, and integration with desktop environments and keyboard shortcuts.

SEE ALSO

Copied to clipboard