Skip to content

Commit

Permalink
Merge pull request #979 from hexane360/patch-1
Browse files Browse the repository at this point in the history
Support for disabling Mate screensaver service
  • Loading branch information
kliment authored Sep 24, 2019
2 parents 55a5326 + e66b0d8 commit d3c225c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions printrun/power/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ def deinhibit_sleep():
inhibit_sleep_token = None
bus = dbus.SessionBus()
try:
# GNOME uses the right object path, try it first
service_name = "org.freedesktop.ScreenSaver"
proxy = bus.get_object(service_name,
"/org/freedesktop/ScreenSaver")
if os.environ.get('DESKTOP_SESSION') == "mate":
# Mate uses a special service
service_name = "org.mate.ScreenSaver"
object_path = "/org/mate/ScreenSaver"
else:
# standard service name
service_name = "org.freedesktop.ScreenSaver"
object_path = "/org/freedesktop/ScreenSaver"
# GNOME and Mate use the right object path, try it first
proxy = bus.get_object(service_name, object_path)
inhibit_sleep_handler = dbus.Interface(proxy, service_name)
# Do a test run
token = inhibit_sleep_handler.Inhibit("printrun", "test")
Expand Down

0 comments on commit d3c225c

Please sign in to comment.