Merge lp:~azzar1/caffeine/notify into lp:caffeine

Proposed by Andrea Azzarone
Status: Rejected
Rejected by: Reuben Thomas
Proposed branch: lp:~azzar1/caffeine/notify
Merge into: lp:caffeine
Diff against target: 36 lines (+7/-7)
1 file modified
caffeine/core.py (+7/-7)
To merge this branch: bzr merge lp:~azzar1/caffeine/notify
Reviewer Review Type Date Requested Status
Reuben Thomas Pending
Review via email: mp+49630@code.launchpad.net

Description of the change

Many users complained that caffeine also disables notifications.
If we replace the freedesktop.org specific org.gnome.ScreenSaver with the freedesktop.org specific org.gnome.SessionManager we don't have this problem. I do not know if there is a special reasons for the choice of org.gnome.ScreenSaver but with this patch Caffeine works the same.

We can also add the possibility to choice between the two option: with notification, without notification.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (TreviƱo) (3v1n0) wrote :

This should be totally merged.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Thanks Marco! I have also add another options in the Preferences Dialog by the witch you can choose if show or not show the notification. The option works only for GNOME for the moment. Unfortunately I do not know whether to go ahead and added support for KDE because the mainteneirs don't answer. How can i do?

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

The reason why this is not implemented is because the Notify-OSD specification states that when the screensaver is inhibited, any non-critical notifications should be hidden.

Personally I feel that adding options instead of sane defaults (and in this case, I would say following the specification is the most sane option) is bad software design. That said, we used to get a fair bit of complaints regarding this. Strangely we haven't gotten any such complaints during the last few months.

I'd like input from Isaiah on this before I give you the green light to keep working on this. You should be aware, however, that the option would have to work in any environment that Caffeine currently supports (gnome screensaver, the kde screensaver that I can't remember the name of, xscreensaver and plain DPMS) in order to be merged.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Thanks for the answer!

I write this sample patch becuase a lot of users complained!

I am waiting for reply Isaiah then.

Revision history for this message
Reuben Thomas (rrt) wrote :

We're now using freedesktop.org's ScreenSaver API.

Unmerged revisions

366. By a

Many users complained that caffeine also disables notifications.
If we replace the freedesktop.org specific org.gnome.ScreenSaver
with the freedesktop.org specific org.gnome.SessionManager
we don't have this problem. I do not know if there is a special
reason for the choice of org.gnome.ScreenSaver but with this patch
Caffeine works the same.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'caffeine/core.py'
2--- caffeine/core.py 2011-01-14 20:12:35 +0000
3+++ caffeine/core.py 2011-02-14 14:27:36 +0000
4@@ -472,7 +472,7 @@
5 After detection is complete, it will finish the inhibiting process."""
6 logging.info("Attempting to detect screensaver/powersaving type... (" + str(self.dbusDetectionFailures) + " dbus failures so far)")
7 bus = dbus.SessionBus()
8- if 'org.gnome.ScreenSaver' in bus.list_names():
9+ if 'org.gnome.SessionManager' in bus.list_names():
10 self.screensaverAndPowersavingType = "Gnome"
11 elif 'org.freedesktop.ScreenSaver' in bus.list_names() and \
12 'org.freedesktop.PowerManagement.Inhibit' in bus.list_names():
13@@ -527,17 +527,17 @@
14
15 def _toggleGnome(self):
16 """Toggle the screensaver and powersaving with the interfaces used by Gnome."""
17-
18 self._toggleDPMS()
19 bus = dbus.SessionBus()
20- self.ssProxy = bus.get_object('org.gnome.ScreenSaver',
21- '/org/gnome/ScreenSaver')
22+ self.ssProxy = bus.get_object('org.gnome.SessionManager',
23+ '/org/gnome/SessionManager')
24+ self.ssProxy_interface = dbus.Interface(self.ssProxy, "org.gnome.SessionManager")
25 if self.sleepIsPrevented:
26 if self.screenSaverCookie != None:
27- self.ssProxy.UnInhibit(self.screenSaverCookie)
28+ self.ssProxy_interface.Uninhibit(self.screenSaverCookie)
29 else:
30- self.screenSaverCookie = self.ssProxy.Inhibit("Caffeine",
31- "User has requested that Caffeine disable the screen saver")
32+ self.screenSaverCookie = self.ssProxy_interface.Inhibit("Caffeine", 0,
33+ "User has requested that Caffeine disable the screen saver", 8)
34
35 def _toggleKDE(self):
36 """Toggle the screensaver and powersaving with the interfaces used by KDE."""

Subscribers

People subscribed via source and target branches