LinuxCommandLibrary

makoctl-invoke

Interact with Mako notifications

TLDR

Invoke the default action on the most recent notification

$ makoctl invoke
copy

Invoke a specific action on a notification (if not specified, default is used)
$ makoctl invoke -n [notification_id] [action_name]
copy

SYNOPSIS

makoctl invoke [notification-id] action-name

PARAMETERS

notification-id
    The unique numerical ID of the notification to perform the action on. This ID can often be seen in Mako's output or retrieved via makoctl list. If omitted, the action is usually applied to the most recently updated notification that supports the specified action.

action-name
    The name of the action to invoke. This name must correspond to an action defined in Mako's configuration file (e.g., reply, dismiss, or custom actions like email).

DESCRIPTION

makoctl-invoke is a subcommand of the makoctl utility, designed to programmatically trigger actions associated with notifications managed by the Mako Wayland notification daemon.

Users can define custom actions within Mako's configuration file (e.g., ~/.config/mako/config) using [action:<name>] sections. These actions might include replying to messages, dismissing notifications, or opening specific applications. The invoke command allows these defined actions to be executed externally, for instance, via keyboard shortcuts managed by a Wayland compositor (like Sway or Hyprland) or through custom scripts.

It can target a specific notification using its unique ID, ensuring the action is applied precisely where intended. If no notification ID is provided, Mako typically attempts to apply the action to the most recently displayed notification that supports it. This functionality provides a powerful way to integrate Mako notifications into a user's workflow and custom automation.

CAVEATS

  • Requires a running mako daemon instance for the command to operate.
  • The specified action-name must be pre-defined and enabled in Mako's configuration file.
  • If notification-id is provided but the notification no longer exists or does not support the action, the command might fail or have no effect.
  • Behavior when notification-id is omitted depends on the specific action and the currently active notifications in Mako.

DEFINING MAKO ACTIONS

Actions in Mako are configured in the ~/.config/mako/config file under [action:<name>] sections. These sections specify what command or script to execute when the action is invoked. For example:
[action:reply]
command=foot -e mutt -i %b %s
(This is a simplified example; actual action definitions might vary and use placeholders like %b for body, %s for subject, etc., depending on the notification content).

RETRIEVING NOTIFICATION IDS

To target a specific notification with makoctl-invoke, you often need its ID. This can be obtained using makoctl list, which outputs a list of active notifications along with their unique IDs. For example, makoctl list | grep "ID:" can help in finding the ID of a notification you wish to interact with.

HISTORY

Mako is a relatively recent addition to the Wayland ecosystem, designed to provide simple, customizable, and lightweight notifications. The makoctl utility, including its invoke subcommand, was developed to give users and scripts programmatic control over the daemon and its notifications. Its emergence reflects the growing need for robust inter-process communication and automation within the Wayland environment, allowing for deep integration with compositors and other desktop components.

SEE ALSO

mako(1), makoctl(1)

Copied to clipboard