hammerspoon2-docs
    Preparing search index...

    Class HSVolumeWatcher

    A volume event watcher that monitors filesystem mount/unmount/rename events. Create via hs.fs.addVolumeWatcher(). Set a callback with setCallback(), then call start() to begin receiving events.

    Event Info keys
    "didMount" path: string
    "didUnmount" path: string
    "willUnmount" path: string
    "didRename" path: string, name: string, oldPath?: string, oldName?: string
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    identifier: string

    The unique identifier assigned to this watcher.

    Methods

    • Stops the watcher and releases all resources. Called automatically during shutdown.

      Returns void

    • Sets the callback function invoked when volume events occur.

      Parameters

      • fn: (event: string, info: Record<string, any>) => void

        Called with the event name and an info dictionary; see type documentation for event names and info keys.

      Returns HSVolumeWatcher

      self, for chaining