Created
March 27, 2018 05:15
-
-
Save ephemient/a82d74a244c545e6de4c295ab38e45f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
inhibit() { | |
while { read -n1 -r -s -t30 || [[ $? -gt 128 ]]; } && [[ -z ${REPLY} ]]; do | |
dbus-send --session --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity | |
done | |
} | |
if [[ $# -gt 0 ]]; then | |
coproc inhibit >&2 | |
command "$@" {COPROC[0]}<&- {COPROC[1]}>&- | |
else | |
inhibit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment