On this page
hs.ipc
Provides Hammerspoon with the ability to create both local and remote message ports for inter-process communication.
The most common use of this module is to provide support for the command line tool hs which can be added to your terminal shell environment with hs.ipc.cliInstall. The command line tool will not work unless the hs.ipc module is loaded first, so it is recommended that you add require("hs.ipc") to your Hammerspoon init.lua file (usually located at ~/.hammerspoon/init.lua) so that it is always available when Hammerspoon is running.
This module is based heavily on code from Mjolnir by Steven Degutis.
API Overview
- Deprecateds - API features which will be removed in an future release
- Functions - API calls offered directly by the extension
- Constructors - API calls which return an object, typically one that offers API methods
- Methods - API calls which can only be made on an object returned by a constructor
API Documentation
Deprecateds
cliGetColors
| Signature | hs.ipc.cliGetColors() -> table |
|---|---|
| Type | Deprecated |
| Description | See hs.ipc.cliColors. |
| Source | extensions/ipc/ipc.lua line 112 |
cliResetColors
| Signature | hs.ipc.cliResetColors() |
|---|---|
| Type | Deprecated |
| Description | See hs.ipc.cliColors. |
| Source | extensions/ipc/ipc.lua line 136 |
cliSetColors
| Signature | hs.ipc.cliSetColors(table) -> table |
|---|---|
| Type | Deprecated |
| Description | See hs.ipc.cliColors. |
| Source | extensions/ipc/ipc.lua line 124 |
Functions
cliColors
| Signature | hs.ipc.cliColors([colors]) -> table |
|---|---|
| Type | Function |
| Description | Get or set the terminal escape codes used to produce colorized output in the |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/ipc.lua line 63 |
cliInstall
| Signature | hs.ipc.cliInstall([path][,silent]) -> bool |
|---|---|
| Type | Function |
| Description | Installs the |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/ipc.lua line 268 |
cliSaveHistory
| Signature | hs.ipc.cliSaveHistory([state]) -> boolean |
|---|---|
| Type | Function |
| Description | Get or set whether or not the command line tool saves a history of the commands you type. |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/ipc.lua line 148 |
cliSaveHistorySize
| Signature | hs.ipc.cliSaveHistorySize([size]) -> number |
|---|---|
| Type | Function |
| Description | Get or set whether the maximum number of commands saved when command line tool history saving is enabled. |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/ipc.lua line 171 |
cliStatus
| Signature | hs.ipc.cliStatus([path][,silent]) -> bool |
|---|---|
| Type | Function |
| Description | Gets the status of the |
| Parameters |
|
| Returns |
|
| Source | extensions/ipc/ipc.lua line 194 |
cliUninstall
| Signature | hs.ipc.cliUninstall([path][,silent]) -> bool |
|---|---|
| Type | Function |
| Description | Uninstalls the |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/ipc.lua line 294 |
Constructors
localPort
| Signature | hs.ipc.localPort(name, fn) -> ipcObject |
|---|---|
| Type | Constructor |
| Description | Create a new local ipcObject for receiving and responding to messages from a remote port |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/libipc.m line 78 |
remotePort
| Signature | hs.ipc.remotePort(name) -> ipcObject |
|---|---|
| Type | Constructor |
| Description | Create a new remote ipcObject for sending messages asynchronously to a local port |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/libipc.m line 128 |
Methods
delete
| Signature | hs.ipc:delete() -> None |
|---|---|
| Type | Method |
| Description | Deletes the ipcObject, stopping it as well if necessary |
| Parameters |
|
| Returns |
|
| Source | extensions/ipc/libipc.m line 338 |
isRemote
| Signature | hs.ipc:isRemote() -> boolean |
|---|---|
| Type | Method |
| Description | Returns whether or not the ipcObject represents a remote or local port |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/ipc/libipc.m line 174 |
isValid
| Signature | hs.ipc:isValid() -> boolean |
|---|---|
| Type | Method |
| Description | Returns whether or not the ipcObject port is still valid or not |
| Parameters |
|
| Returns |
|
| Source | extensions/ipc/libipc.m line 195 |
name
| Signature | hs.ipc:name() -> string |
|---|---|
| Type | Method |
| Description | Returns the name the ipcObject uses for its port when active |
| Parameters |
|
| Returns |
|
| Source | extensions/ipc/libipc.m line 156 |
sendMessage
| Signature | hs.ipc:sendMessage(data, msgID, [waitTimeout], [oneWay]) -> status, response |
|---|---|
| Type | Method |
| Description | Sends a message from a remote port to a local port |
| Parameters |
|
| Returns |
|
| Source | extensions/ipc/libipc.m line 213 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.ipc.html