Internationalisation
Bundled Plugins API
dockicon
Control Hammerspoon's dock icon
This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.

API Overview

API Documentation

Functions

bounce

Signature
hs.dockicon.bounce(indefinitely)
Type
Function
Description
Bounce Hammerspoon's dock icon
Parameters
  • indefinitely - A boolean value, true if the dock icon should bounce until the dock icon is clicked, false if the dock icon should only bounce briefly

hide

Signature
hs.dockicon.hide()
Type
Function
Description
Hide Hammerspoon's dock icon
Parameters
  • None
Returns
  • None

setBadge

Signature
hs.dockicon.setBadge(badge)
Type
Function
Description
Set Hammerspoon's dock icon badge
Parameters
  • badge - A string containing the label to place inside the dock icon badge. If the string is empty, the badge will be cleared

show

Signature
hs.dockicon.show()
Type
Function
Description
Make Hammerspoon's dock icon visible
Parameters
  • None
Returns
  • None
| Signature | hs.dockicon.tileCanvas([canvas]) -> canvasObject | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Function | | Description | Get or set a canvas object to be displayed as the Hamemrspoon dock icon | | Parameters |
  • canvas - an optional hs.canvas object specifying the canvas to be displayed as the dock icon for Hammerspoon. If an explicit nil is specified, the dock icon will revert to the Hammerspoon application icon.
| | Returns |
  • If the dock icon is assigned a canvas object, that canvas object will be returned, otherwise returns nil.
| | Notes |
  • If you update the canvas object by changing any of its components, it will not be reflected in the dock icon until you invoke hs.dockicon.tileUpdate.
|

tileSize

Signature
hs.dockicon.tileSize() -> size table
Type
Function
Description
Returns a table containing the size of the tile representing the dock icon.
Parameters
  • None
Returns
  • a table containing the size of the tile representing the dock icon for Hammerspoon. This table will contain h and w keys specifying the tile height and width as numbers.
Notes
  • the size returned specifies the display size of the dock icon tile. If your canvas item is larger than this, then only the top left portion corresponding to the size returned will be displayed.
Signature
hs.dockicon.tileUpdate() -> none
Type
Function
Description
Force an update of the dock icon.
Parameters
  • None
Returns
  • None
Notes
  • Changes made to a canvas object are not reflected automatically like they are when a canvas is being displayed on the screen; you must invoke this method after making changes to the canvas for the updates to be reflected in the dock icon.

visible

Signature
hs.dockicon.visible() -> bool
Type
Function
Description
Determine whether Hammerspoon's dock icon is visible
Parameters
  • None
Returns
  • A boolean, true if the dock icon is visible, false if not
Last modified 1mo ago
Export as PDF
Copy link