updated on Thu Jan 19 00:16:31 UTC 2012
[aur-mirror.git] / disablegss / README.txt
blob736dbcecc4e088c50e16b1476b93009159831762
1 From http://ubuntuforums.org/showthread.php?t=284804, Author crazy___cow on
2 October 26th, 2006
4 HOWTO disable screensaver and powermanager while mplayer or other apps are
5 running
7 I have written a small python daemon to disable gnome-screensaver and
8 gnome-powermanager while certain specified apps are running.
9 It works quite well on Ubuntu Edgy. It requires dbus (>= 0.93), python-dbus,
10 and obviously gnome-screensaver and gnome-powermanager (on gnome 2.16).
11 The idea is simple: I have seen how Totem is working, and I emulate its
12 behavior with a small python daemon.
13 To install it just copy "disablegss.py" in /usr/local/bin, fix its execute
14 permissions and create a simple config file in your homedir "~/.disablegss".
15 In this config file add every application name that could stop
16 gnome-screensaver, one for each line. Example:
18 Code:
20 mplayer
21 gmplayer
22 vlc
23 wxvlc
24 xine
25 gxine
27 Please notice you must insert the name of the app how you can see it on
28 'ps aux': for example if you want to add firefox, you must write a line with
29 "/usr/lib/firefox/firefox-bin".
30 Now just launch disablegss.py on a terminal or simply add it on your session!
31 You can change the config file on fly (I check if someone modify it), adding or
32 removing apps without restarting it.
35 HOW IT WORKS
36 Unfortunately the dbus and gnome development documentation are a bit outdated,
37 so I have read totem sources to view which methods are called to stop
38 gnome-screensaver and gnome-powermanager. The idea is if you call the Inhibit
39 method of gnome-screensaver, you disable the screensaver AND the powermanager.
40 To enable them again you must call the UnInhibit method. There is a small
41 terminal app, dbus-send, to comunicate with dbus but it doesn't work well with
42 these methods, so I decide to use the python dbus interface. This is my first
43 program in python so please tell me if something is wrong or not well coded!
44 Every 60 secs the daemon check if there are apps running that are also present
45 in the config file. If it's true, the screensaver is disabled. If someone
46 change the config file, the daemon read it again.
47 I don't think that this small daemon could run on Dapper: the dbus and gnome
48 API change on every release. But you can modify it to fix things. There are
49 only two lines that could be problematic:
51 Line 38: cookie = dev.Inhibit(myprogram, 'Disabled by DisableGSS Daemon')
52 Line 49: dev.UnInhibit(cookie)
54 These two methos are different on gnome 2.14 on Dapper. Also dbus has radically
55 changed. If you want to use disablegss.py on Dapper, find the right methods
56 (try to see dapper totem sources) and feel free to change what you want!
57 To do debug, I suggest you to launch disablegss.py on a terminal and
58 dbus-monitor on another one (you can see all messages from and to dbus daemon).
59 Also change the sleep time value in seconds (line 121) to debug it faster.
60 Happy coding!