Control system power states (sleeping, preventing sleep, screen locking, etc)
NOTE: Any sleep preventions will be removed when hs.reload() is called. A future version of the module will save/restore state across reloads.
| Signature | hs.caffeinate.currentAssertions() |
|---|---|
| Type | Function |
| Description |
Fetches information about processes which are currently asserting display/power sleep restrictions |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/libcaffeinate.m line 296 |
| Signature | hs.caffeinate.declareUserActivity([id]) |
|---|---|
| Type | Function |
| Description |
Informs the OS that the user performed some activity |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/caffeinate/libcaffeinate.m line 209 |
| Signature | hs.caffeinate.fastUserSwitch() |
|---|---|
| Type | Function |
| Description |
Show the Fast User Switch screen (ie a login screen without logging out first) |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 109 |
| Signature | hs.caffeinate.get(sleepType) -> bool or nil |
|---|---|
| Type | Function |
| Description |
Queries whether a particular sleep type is being prevented |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 55 |
| Signature | hs.caffeinate.lockScreen() |
|---|---|
| Type | Function |
| Description |
Locks the displays |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/caffeinate/libcaffeinate.m line 237 |
| Signature | hs.caffeinate.logOut() |
|---|---|
| Type | Function |
| Description |
Request the system log out the current user |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 135 |
| Signature | hs.caffeinate.restartSystem() |
|---|---|
| Type | Function |
| Description |
Request the system reboot |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 148 |
| Signature | hs.caffeinate.sessionProperties() |
|---|---|
| Type | Function |
| Description |
Fetches information from the display server about the current session |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/caffeinate/libcaffeinate.m line 271 |
| Signature | hs.caffeinate.set(sleepType, aValue, acAndBattery) |
|---|---|
| Type | Function |
| Description |
Configures the sleep prevention settings |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/caffeinate/caffeinate.lua line 11 |
| Signature | hs.caffeinate.shutdownSystem() |
|---|---|
| Type | Function |
| Description |
Request the system log out and power down |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 161 |
| Signature | hs.caffeinate.startScreensaver() |
|---|---|
| Type | Function |
| Description |
Request the system start the screensaver (which may lock the screen if the OS is configured to do so) |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/caffeinate.lua line 122 |
| Signature | hs.caffeinate.systemSleep() |
|---|---|
| Type | Function |
| Description |
Requests the system to sleep immediately |
| Parameters |
|
| Returns |
|
| Source | extensions/caffeinate/libcaffeinate.m line 193 |
| Signature | hs.caffeinate.toggle(sleepType) -> bool or nil |
|---|---|
| Type | Function |
| Description |
Toggles the current state of the specified type of sleep |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/caffeinate/caffeinate.lua line 82 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.caffeinate.html