Categorygithub.com/unixdj/ussssr
repositorypackage
0.0.0-20240129201548-f24364f116d1
Repository: https://github.com/unixdj/ussssr.git
Documentation: pkg.go.dev

# README

USSSSR, a UPower/Systemd Screen Saving Sleep Reactor

Copyright (c) 2013, 2022 Vadim Vygonets [email protected]

Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Licensed under ISC License.

Installation:

go get github.com/unixdj/ussssr go install github.com/unixdj/ussssr

Usage:

ussssr [-b] COMMAND [ARGS...]

USSSSR listens to sleep (suspend, hibernate) events broadcast by UPower or systemd on D-Bus and reacts to them by running a command which presumably will activate a screen saver to lock the screen.

Upon startup USSSSR tries to open the systemd backend; if it's not available, UPower is tried; if that ain't there either, we bail out.

In case the systemd backend is chosen, USSSSR inhibits sleep by taking a delay lock. Unless the flag -b was passed, USSSSR will wait until the program finishes before releasing the lock, or unil it times out (three seconds). Thus, commands such as "xset s activate" and "xscreensaver -lock", that activate the screen saver and exit, should be run in the foreground (i.e., don't use -b).

Regardless of whether the commands are run in the foreground or in the background, no more than one copy of the program will run at any time. If a sleep event arrives while the program is running, the event will be swallowed.