hs.appinfo
ModuleModule for accessing information about the Hammerspoon application itself
Properties
hs.appinfo.bundleIdentifier
The application's bundle identifier (e.g., "com.hammerspoon.Hammerspoon-2")
hs.appinfo.configDir
The filesystem path to the directory Hammerspoon 2 loaded its config from
hs.appinfo.machineName
The user-assigned name of this Mac, as shown in System Settings > Sharing
hs.appinfo.environment
The environment variables Hammerspoon 2 was launched with
hs.appinfo.osVersion
The version of macOS Hammerspoon 2 is currently running on (e.g., "Version 26.5.2 (Build 25F84)")
hs.appinfo.osVersionParts
The version of macOS Hammerspoon 2 is currently running on, broken into its numeric components
Keys: major, minor, patch.
Methods
hs.appinfo.versionAtLeast(version) -> boolean
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.
hs.appinfo.versionAtLeast(version) -> boolean
| Name | Type | Description |
|---|---|---|
| version | string | A version such as "1.0.0" or "1.0.0-beta.4" |
hs.appinfo.version) is the same as or newer than versionif (hs.appinfo.versionAtLeast("1.0.0-beta.3")) {
// hs.canvas measures y from the top of the screen
}