ok, eu achei, isso é muito legal já que ele está definido em seconds
você também pode definir um valor menor que um minuto:
# Set "turn screen off" to (N)seconds:
gsettings set org.gnome.desktop.session idle-delay N
# Set "turn screen off" to never:
gsettings set org.gnome.desktop.session idle-delay 0
# Set "turn screen off" to 1 minute (60)seconds:
gsettings set org.gnome.desktop.session idle-delay 60
No script, uso-o da seguinte forma:
# getting the time of current setting and store to variable 'screenoff'
screenoff=$(gsettings get org.gnome.desktop.session idle-delay \
| awk '{print $2}')
# set "turn screen off" to never
gsettings set org.gnome.desktop.session idle-delay 0
echo "lots of important information being printed..."
# set back to the former setting:
gsettings set org.gnome.desktop.session idle-delay "$screenoff"
o valor armazenado em $screenoff
naturalmente se perderia se o script fosse cancelado antes da conclusão.
Uma solução alternativa poderia ser armazenar o valor em temporary file
, que obtém removed
no final do script:
#!/bin/bash
# check if there is a temporary file from an aborted session
# read from this file or get value from gsettings & write temporay file:
if [ -f "./.screenoff.tmp" ]; then
screenoff=$(cat "./.screenoff.tmp")
else
screenoff=$(gsettings get org.gnome.desktop.session idle-delay \
| awk '{print $2}')
echo "$screenoff" > "./.screenoff.tmp"
fi
# switch power saving off:
gsettings set org.gnome.desktop.session idle-delay 0
echo "lots of important information being printed..."
# Set "turn screen off" back to original value:
gsettings set org.gnome.desktop.session idle-delay "$screenoff"
# remove temporary file
rm "./.screenoff.tmp"