Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gnome 3 inhibitor for VLC (Bash)
#!/bin/bash
IDLE_ACTIVATION_ENABLED=$(gsettings get org.gnome.desktop.screensaver idle-activation-enabled)
SLEEP_INACTIVE_AC=$(gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac)
SLEEP_INACTIVE_BATTERY=$(gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery)
start_inhibitor () {
if [ $IDLE_ACTIVATION_ENABLED == true ]; then
gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
fi
if [ $SLEEP_INACTIVE_AC == true ]; then
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac false
fi
if [ $SLEEP_INACTIVE_BATTERY == true ]; then
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery false
fi
}
stop_inhibitor () {
if [ $IDLE_ACTIVATION_ENABLED == true ]; then
gsettings set org.gnome.desktop.screensaver idle-activation-enabled true
fi
if [ $SLEEP_INACTIVE_AC == true ]; then
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac true
fi
if [ $SLEEP_INACTIVE_BATTERY == true ]; then
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery true
fi
}
start_inhibitor
trap stop_inhibitor SIGINT SIGTERM
/usr/bin/vlc "$@"
stop_inhibitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment