hammerspoon2-docs
    Preparing search index...

    Class HSUIAlert

    HSUIAlert

    A temporary on-screen notification* Displays a message that automatically fades out after a specified duration. Positioned in the center of the screen with a semi-transparent background.

    hs.ui.alert("Task completed!")
    .font(HSFont.headline())
    .duration(5)
    .padding(30)
    .show();
    Index

    Constructors

    Methods

    • Close the alert immediately

      Returns void

    • Set how long the alert is displayed

      Parameters

      • seconds: number

        Duration in seconds (default: 5.0)

      Returns HSUIAlert

      Self for chaining

    • Set the font for the alert text

      Parameters

      • font: HSFont

        An HSFont object (e.g., HSFont.headline())

      Returns HSUIAlert

      Self for chaining

    • Set the padding around the alert text

      Parameters

      • points: number

        Padding in points (default: 20)

      Returns HSUIAlert

      Self for chaining

    • Set a custom position for the alert

      Parameters

      • dict: Record<string, any>

        Dictionary with x and y coordinates

      Returns HSUIAlert

      Self for chaining

    • Show the alert

      Returns HSUIAlert

      Self for chaining (can store reference to close manually)