Created
July 30, 2016 23:49
-
-
Save jneen/fe356e4ac95503922b108a710855c4fa to your computer and use it in GitHub Desktop.
This file contains 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 | |
blanking() { | |
local mode="$1"; shift | |
case "$mode" in | |
-|stop) xset -dpms; xset s off ;; | |
+|start) xset +dpms; xset s on ;; | |
sus|suspend) | |
wake-loop & | |
ensure kill $! | |
"$@" | |
;; | |
*) return 1 ;; | |
esac | |
} | |
wake() { | |
if [[ $# -eq 0 ]]; then wake 20m; return $?; fi | |
run blanking suspend sleep "$@" | |
} | |
wake-loop() { | |
blanking stop | |
while sleep 50; do blanking stop; done | |
} |
This file contains 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 | |
PROMPT_COMMAND="__ensure_hook;$PROMPT_COMMAND" | |
ENSURE='' | |
__ensure_hook() { | |
[[ -n "$ENSURE" ]] && eval "$ENSURE" | |
ENSURE='' | |
} | |
ensure() { | |
ENSURE="$@; $ENSURE" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment