Skip to content

0.16.1: keep the computer awake while playing - #30

Merged
catchouli merged 2 commits into
mainfrom
keep-awake
Oct 18, 2026
Merged

catchouli merged 2 commits into
mainfrom
keep-awake

Conversation

@catchouli

Copy link
Copy Markdown
Owner

Fixes the TV PC going to sleep in the middle of a video.

Flex draws mpv's picture itself, so mpv's own stop-screensaver never applied. Now, while something is playing (not paused):

  • Video keeps the screen and the computer on.
  • Music keeps only the computer on, so the screen can still turn off.

Pausing or stopping lets it sleep normally again.

Platform How
Windows SetThreadExecutionState (what media players use)
macOS caffeinate (-w ties it to Flex, so it can't outlive a crash)
Linux systemd-inhibit around cat (exits when Flex's end of the pipe closes)

If the helper is missing, Flex logs one warning and carries on.

Tested: builds and clippy on macOS, Windows target checks; the macOS caffeinate flags hold both sleep and display assertions (pmset -g assertions). Not yet tried on the TV PC or meownix.

Flex draws mpv's picture itself, so mpv's own screensaver blocking never
applied. Videos now keep the screen and computer on, music keeps the
computer on; pausing or stopping lets it sleep again. Windows uses
SetThreadExecutionState, macOS caffeinate, Linux systemd-inhibit.
@catchouli
catchouli merged commit 8d155f9 into main Oct 18, 2026
2 checks passed
@catchouli
catchouli deleted the keep-awake branch October 18, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant