Watch for Pasteboard Changes. macOS doesn't offer any API for getting Pasteboard notifications, so this extension uses polling to check for Pasteboard changes at a chosen interval (defaults to 0.25).
Signature | hs.pasteboard.watcher.interval([value]) -> number |
---|---|
Type | Function |
Description | Gets or sets the polling interval (i.e. the frequency the pasteboard watcher checks the pasteboard). |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/pasteboard/libpasteboard_watcher.m line 249 |
Signature | hs.pasteboard.watcher.new(callbackFn[, name]) -> pasteboardWatcher |
---|---|
Type | Constructor |
Description | Creates and starts a new |
Parameters |
|
Returns |
|
Notes |
generalPBWatcher = hs.pasteboard.watcher.new(function(v) print(string.format("General Pasteboard Contents: %s", v)) end)
specialPBWatcher = hs.pasteboard.watcher.new(function(v) print(string.format("Special Pasteboard Contents: %s", v)) end, "special")
hs.pasteboard.writeObjects("This is on the general pasteboard.")
hs.pasteboard.writeObjects("This is on the special pasteboard.", "special")```
|
Source | extensions/pasteboard/libpasteboard_watcher.m line 143 |
Signature | hs.pasteboard.watcher:running() -> boolean |
---|---|
Type | Method |
Description | Returns a boolean indicating whether or not the Pasteboard Watcher is currently running. |
Parameters |
|
Returns |
|
Source | extensions/pasteboard/libpasteboard_watcher.m line 209 |
Signature | hs.pasteboard.watcher:start() -> timer |
---|---|
Type | Method |
Description | Starts an |
Parameters |
|
Returns |
|
Source | extensions/pasteboard/libpasteboard_watcher.m line 187 |
Signature | hs.pasteboard.watcher:stop() -> timer |
---|---|
Type | Method |
Description | Stops an |
Parameters |
|
Returns |
|
Source | extensions/pasteboard/libpasteboard_watcher.m line 228 |