hammerspoon2-docs
    Preparing search index...

    Interface HSAppinfoModule

    Module for accessing information about the Hammerspoon application itself

    interface HSAppinfoModule {
        appName: string;
        arguments: string[];
        build: string;
        bundleIdentifier: string;
        bundlePath: string;
        configDir: string;
        configPath: string;
        copyrightNotice: string;
        displayName: string;
        environment: Record<string, string>;
        machineName: string;
        minimumOSVersion: string;
        osVersion: string;
        osVersionParts: Record<string, number>;
        pid: number;
        resourcePath: string;
        version: string;
        versionAtLeast(version: string): boolean;
    }
    Index
    appName: string

    The application's internal name (e.g., "Hammerspoon 2")

    arguments: string[]

    The command-line arguments Hammerspoon 2 was launched with

    build: string

    The application's build number

    bundleIdentifier: string

    The application's bundle identifier (e.g., "com.hammerspoon.Hammerspoon-2")

    bundlePath: string

    The filesystem path to the application bundle

    configDir: string

    The filesystem path to the directory Hammerspoon 2 loaded its config from

    configPath: string

    The filesystem path to the main Hammerspoon 2 configuration file

    copyrightNotice: string

    The copyright notice for this application

    displayName: string

    The application's display name shown to users

    environment: Record<string, string>

    The environment variables Hammerspoon 2 was launched with

    machineName: string

    The user-assigned name of this Mac, as shown in System Settings > Sharing

    minimumOSVersion: string

    The minimum macOS version required to run this application

    osVersion: string

    The version of macOS Hammerspoon 2 is currently running on (e.g., "Version 26.5.2 (Build 25F84)")

    osVersionParts: Record<string, number>

    The version of macOS Hammerspoon 2 is currently running on, broken into its numeric components

    Keys: major, minor, patch.

    pid: number

    Hammerspoon 2's Process Identifier (PID)

    resourcePath: string

    The filesystem path to the application's resource directory

    version: string

    The application's version string (e.g., "2.0.0")

    • Whether this Hammerspoon 2 is at least a given version, so code that relies on a change made in a particular release can check for it.

      Versions are compared as Semantic Versioning orders them, not as strings: 1.0.0-beta.9 comes before 1.0.0-beta.10, which comes before 1.0.0-rc.1 and then 1.0.0. One to three numbers may be given, and missing ones count as zero, so "1.2" is the same as "1.2.0". A copy of Hammerspoon 2 built from source has the version of the last release before it.

      Parameters

      • version: string

        A version such as "1.0.0" or "1.0.0-beta.4"

      Returns boolean

      true if this Hammerspoon 2's version (hs.appinfo.version) is the same as or newer than version

      Throws an Error on failure; wrap calls in try/catch to handle it.