Last active
June 22, 2020 11:30
-
-
Save klingtnet/80ebf1594b6d5bf1b3d159b87f1eb5e5 to your computer and use it in GitHub Desktop.
Disable auto suspend in Gnome (presentation mode)
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 | |
_cmd=${1:-'help'} | |
case $_cmd in | |
"on") | |
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'nothing'" | |
;; | |
"off") | |
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'suspend'" | |
;; | |
"status") | |
_powerstate=$(dconf read /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type) | |
if [ $_powerstate == "'nothing'" ]; then | |
echo 'on' | |
else | |
echo 'off' | |
fi | |
;; | |
"help") | |
echo "Usage: $0 [on/off/status]" | |
;; | |
*) | |
echo "Unknown command '$@'" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment