Play/pause music players when headphones are connected/disconnected
Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/HeadphoneAutoPause.spoon.zip
| Signature | HeadphoneAutoPause.autoResume |
|---|---|
| Type | Variable |
| Description | Boolean value indicating if music should be automatically resumed when headphones are plugged in again. Only works if music was automatically paused when headphones were unplugged. |
| Notes |
|
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 43 |
| Signature | HeadphoneAutoPause.control |
|---|---|
| Type | Variable |
| Description | Table containing one key per application, with the value indicating whether HeadphoneAutoPause should try to pause/unpause that application in response to the headphone being plugged/unplugged. |
| Notes |
|
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 22 |
| Signature | HeadphoneAutoPause.controlfns |
|---|---|
| Type | Variable |
| Description | Table containing control functions for each application to control. |
| Notes |
|
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 68 |
| Signature | HeadphoneAutoPause.logger |
|---|---|
| Type | Variable |
| Description | Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon. |
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 17 |
| Signature | HeadphoneAutoPause:audiodevwatch(dev_uid, event_name) |
|---|---|
| Type | Method |
| Description | Callback function to use as an audio device watcher, to pause/unpause the application on headphones plugged/unplugged |
| Parameters |
|
| Returns | |
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 97 |
| Signature | HeadphoneAutoPause.defaultControlFns(app) |
|---|---|
| Type | Method |
| Description | Generate the most common set of application control definition. |
| Parameters |
|
| Returns |
|
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 51 |
| Signature | HeadphoneAutoPause:start() |
|---|---|
| Type | Method |
| Description | Start headphone detection on all audio devices that support it |
| Parameters |
|
| Returns | |
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 137 |
| Signature | HeadphoneAutoPause:stop() |
|---|---|
| Type | Method |
| Description | Stop headphone detection |
| Parameters |
|
| Returns | |
| Source | Source/HeadphoneAutoPause.spoon/init.lua line 157 |