Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☕ slpless

Keep your Mac or Linux machine awake for a set number of hours — then let it sleep.

slpless is a tiny command-line tool. You give it a time (like 8 for 8 hours) and it stops your computer from going to sleep for that long. When the time is up, everything goes back to normal automatically.

It's lightweight (zero dependencies), cross-platform (macOS + Linux), and self-healing: if the thing keeping your machine awake ever gets killed, slpless notices and brings it right back.

$ slpless 8
☕ slpless — keeping this machine awake for 8h 0s
   it will sleep normally again at 11:24 PM · press Ctrl-C to stop early

   ⏳ 7h 59m 58s remaining

Install

With Node.js 14+ installed:

npm install -g slpless

Not published to npm yet? You can install straight from GitHub:

npm install -g DevStrategist/slpless

That's it — the slpless command is now available everywhere.

Use

slpless 8          # stay awake for 8 hours (live countdown in your terminal)
slpless 30m        # 30 minutes
slpless 90s        # 90 seconds
slpless 0.5h       # half an hour

A bare number means hours. You can also write h, m, or s.

Run it in the background

Add -d and slpless keeps going even after you close the terminal:

slpless 8 -d       # 8 hours, in the background
slpless status     # how much time is left?
slpless stop       # end it early
$ slpless status
☕ slpless is awake.
   pid:        48213
   remaining:  6h 12m 04s
   wakes at:   11:24 PM

All commands

Command What it does
slpless <time> Keep awake for <time> with a live countdown
slpless <time> -d Same, but in the background
slpless status Show the current background session
slpless stop End the background session early
slpless --help Show help
slpless --version Show the version

How it works

slpless doesn't reinvent anything — it drives the tool your OS already ships with:

On top of that it adds a small supervisor. It watches the sleep-blocker, and if that process ever exits early — crashed, OOM-killed, killed by accident — it respawns it and keeps going until your time is up. Every sleep-blocker it starts is also given a hard time limit, so even in the worst case (say slpless itself is force-killed with kill -9), your machine falls back to sleeping normally instead of staying awake forever.

No background daemons are installed, nothing runs at boot, and there are zero npm dependencies.

Good to know

  • Laptop lids. On Linux, slpless also blocks the lid switch. On a Mac laptop, closing the lid may still sleep the machine unless an external display is attached — that's a macOS hardware behavior caffeinate can't override.
  • Requires systemd on Linux. systemd-inhibit ships with systemd, which nearly all modern Linux desktops use.
  • It's per-session. Closing a foreground run (Ctrl-C or closing the terminal) ends it. Use -d if you want it to outlive the terminal.

Develop

git clone https://github.com/DevStrategist/slpless.git
cd slpless
npm test            # runs the duration-parser tests
node bin/slpless.js 10s   # try it for 10 seconds

License

MIT

About

Keep your Mac or Linux machine awake for a set number of hours. Lightweight, zero-dependency, self-healing CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages