Skip to content

Instantly share code, notes, and snippets.

@meyerbaptiste
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meyerbaptiste/10deab0b05c13b0fba97 to your computer and use it in GitHub Desktop.
Save meyerbaptiste/10deab0b05c13b0fba97 to your computer and use it in GitHub Desktop.
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