sleepwatcher(8)
โจ NAME โจ
Hey bestie! Welcome to the sleepwatcher(8) manual page โ the System Manager's Manual for your new fave daemon. ๐
sleepwatcher โ daemon to monitor sleep, wakeup and idleness of a Mac
๐ธ SYNOPSIS ๐ธ
sleepwatcher [-n] [-v] [-V] [-d] [-g] [-f configfile] [-p pidfile]
[-a[allowsleepcommand]] [-c cantsleepcommand]
[-s sleepcommand] [-w wakeupcommand] [-D displaydimcommand]
[-E displayundimcommand] [-S displaysleepcommand]
[-W displaywakeupcommand] [-t timeout -i idlecommand
[-R idleresumecommand]] [-b break -r resumecommand]
[-P plugcommand] [-U unplugcommand]
๐ฆ DESCRIPTION ๐ฆ
Okay so sleepwatcher is literally that girl โ a program that monitors sleep, wakeup and idleness of a Mac. It can execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up, after a given time without user interaction or when the user resumes activity after a break or when the power supply of a Mac notebook is attached or detached. It also can send the Mac to sleep mode or retrieve the time since last user activity. No cap, it does it all. ๐
Command line options:
-n,--nowโ Sleep now and exit, ignoring other options. Like, immediate main character energy. ๐ด-v,--versionโ Display version and copyright information and exit. Show me your ID, bestie. ๐ชช-V,--verboseโ Log any action sleepwatcher performs, either to stdout or, when running as daemon, to the syslog. It's giving "tell me everything." ๐ฃ๏ธ-d,--daemonโ Run as background daemon. Don't use this option when starting sleepwatcher vialaunchd(8). Lowkey important โ read that again. ๐ซ-g,--getidletimeโ Print the time (in 0.1 seconds) of no keyboard or mouse activity to stdout and exit, ignoring other options. Just a quick vibe check on your idle time. โฑ๏ธ-f configfile,--config configfileโ Read additional configuration options from configfile. configfile contains options in the formoption [ = value ]where option is one of the long command line options (without--). sleepwatcher rereads its configuration file when it receives a hangup signal,SIGHUP. Okay so it's a whole mood โ it can refresh its fit. ๐-p pidfile,--pidfile pidfileโ Write the process id of sleepwatcher to pidfile. Keep track of bae's location. ๐-a[allowsleepcommand],--allowsleep[=allowsleepcommand]โ Allow the Mac to idle sleep only when allowsleepcommand returns a zero exit code. Without allowsleepcommand, this option prevents idle sleep at all. When the-aoption is not used at all, sleepwatcher allows idle sleep unconditionally. (Note: no space after the-a.) ๐ This one's got lore โ it's the permission slip.-c cantsleepcommand,--cantsleep cantsleepcommandโ Execute cantsleepcommand when the Mac retracts an attempt to sleep that was previously allowed by the-aoption, but vetoed by another process that wants to prevent idle sleep. Note that the kernel notifies sleepwatcher about the retracted sleep only when it previously asked it if sleeping is allowed. There might be canceled idle sleep attempts without the-aand-ccommands executed at all. ๐ญ The drama. The betrayal.-s sleepcommand,--sleep sleepcommandโ Execute sleepcommand when the Mac is put to sleep mode. sleepcommand must not take longer than 15 seconds because after this timeout the sleep mode is forced by the system. โฐ Bestie, do NOT overstay your welcome.-w wakeupcommand,--wakeup wakeupcommandโ Execute wakeupcommand when the Mac wakes up from sleep mode. Rise and shine, queen. ๐-D displaydimcommand,--displaydim displaydimcommandโ Execute displaydimcommand when the display of the Mac is dimmed. Note that the displaydimcommand is executed when the Mac goes to sleep mode, too. Dim the lights, it's giving mood lighting. ๐ก-E displayundimcommand,--displayundim displayundimcommandโ Execute displayundimcommand when the display of the Mac is undimmed without having gone to sleep. Note that the displayundimcommand is not executed when the Mac or the display of the Mac wakes up from sleep mode. So petty โ it only un-dims for the specific case. ๐-S displaysleepcommand,--displaysleep displaysleepcommandโ Execute displaysleepcommand when the display of the Mac is put to sleep mode. Screen's sleeping, not the whole Mac. โจ-W displaywakeupcommand,--displaywakeup displaywakeupcommandโ Execute displaywakeupcommand when the display of the Mac wakes up from sleep mode. Note that the displaywakeupcommand is executed when the Mac wakes up from sleep mode, too. Double duty, she's versatile. ๐ฅ-t timeout,--timeout timeoutโ Set the timeout (in 0.1 seconds) for the-ioption, i. e. execute idlecommand after this time of no user interactivity. The patience level. โณ-i idlecommand,--idle idlecommandโ Execute idlecommand after the time of no user interactivity set with the-toption. When you're bored, this runs. ๐ฎ-R idleresumecommand,--idleresume idleresumecommandโ Execute idleresumecommand when the user resumes input after the-icommand was executed due to an idle time. Welcome back, bestie! ๐ซถ-b breakduration,--break breakdurationโ Set the breakduration (in 0.1 seconds) for the-roption, i. e. execute resumecommand when the user resumes input after a break of at least this duration. How long is a "break"? You decide. โ-r resumecommand,--resume resumecommandโ Execute resumecommand when the user resumes keyboard or mouse activity after a break with a duration given with the-boption. Gryffindor! ๐ฆ-P plugcommand,--plug plugcommandโ Execute plugcommand when a Mac notebook is connected to the power supply. Charging szn. ๐-U unplugcommand,--unplug unplugcommandโ Execute unplugcommand when a Mac notebook is disconnected from the power supply. On battery, living free. ๐
๐ SEE ALSO ๐
pmset(1), launchd(8), SystemStarter(8)
๐ BUGS ๐
The-t-iand-b-roptions only work when the Mac OS X GUI is running, so they cannot be used when sleepwatcher is started as a system-widelaunchd(8)agent during system startup. ๐ซ Like, sorry bestie, no GUI no idle party.
Any user with execute permission for sleepwatcher can send the Mac to sleep mode with the -n option, making the system unavailable for other (remote) users. ๐ณ Highkey a prank waiting to happen โ protect your perms!
๐ ACKNOWLEDGEMENTS ๐
Thanks to Daniel Griscom for the idea and code for the deny sleep feature. Thanks to Darren Creutz for the idea and code for the display sleep support. Thanks to Michael Lee for the ideas for idleness handling within sleepwatcher. Thanks to Brian Jenkins for the idea and code for the power supply feature. And thanks to Louis Pan for the idea and code for the can't sleep callback. ๐ Y'all ate, fr fr.
This page is from Darwin, dated Fri Apr 2 2010. Bye bestie! ๐ โจ
๐ฆ where this page comes from
- nixpkgs unstable: sleepwatcher 2.2.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms