FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

LinkBack Thread Tools
Old 07-01-2012, 11:01 PM
Andrew Wood
Default Solution for Gnome 3 screen blanking

After much experimenting and hair pulling I thought Id share my solution
for disabling the screen blanking on Gnome 3.

There are various solutions on the web but this is the only one Ive
found which always works every boot and keeps working after upgrades.

Basically it consists of a Python script which is lauched automatically
at login.

Id like to credit a website here which gave me the key idea but
unfortunately I can no longer find it.

Basically you need to use DBus to request the screensaver be inhibited,

Catch 1 is, the inhibit only applies as long as the process which
requested it is still running. Therefore its no good using the dbus
commands in a shell script as each command runs as a separate process
and terminates, therefore you need to write your own program which will
request a DBus inhibit then sleep rather than exiting. Python provides a
nice easy portable solution akin to a shell script.

Catch 2 is that the screensaver daemon must be running BEFORE you call

Catch 3 is that although the screensaver daemon runs automatically when
you log in, if you then run your Python script manually from the
terminal it will work, but if you set your Python script to also run
automantically at login, then, due to the scheduling order, you cannot
guarantee it will always request the inhibit until after the daemon has
started. Therefore you need to make it loop so it periodically requests
an inhibit, this way if the daemon wasnt running the first time through
the loop it will be later on. This also makes it robust if the
screensaver daemon should restart for whatever reason. How long you
sleep for is a tradeoff - too little and you waste processor cycles, too
long and the screensaver timer will kick in before youve inhibited it.
30 seconds is a good value guaranteed to always work as the minimum time
setting in System Settings is 1 min, but you can adjust this upwards if
you have the screen saver time set higher in System Settings.

The code for the script follows at the end.

To run it you need to open gnome-session-properties from the terminal
and add an entry for the Python script and also make sure the Gnome
screensaver daemon is enabled. If like me, as an earlier attempt at
disabling the screensaver you disabled the daemon, you MUST re-enable
it, in order for the inhibit request to work - the entry is called
'Screensaver' with the description 'Launch screensaver and locker program'

Ive had this running on a public touchscreen terminal for months
flawlessly, accross dozens of reboots and it survied the upgrade from
Gnome 3.2 to 3.4

Hope its of some help to others.


Python code

import dbus
import os
import time

while True:
bus = dbus.SessionBus()
proxy =

proxy.Inhibit("something",dbus.UInt32(0),"inhibiti ng",dbus.UInt32(8))
os.system("xset -dpms")


To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FF0D6C8.8090403@perpetualmotion.co.uk">http://lists.debian.org/4FF0D6C8.8090403@perpetualmotion.co.uk

Thread Tools

All times are GMT. The time now is 12:57 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org