#!/usr/bin/python import dbus import time bus = dbus.Bus(dbus.Bus.TYPE_SESSION) devobj = bus.get_object('org.freedesktop.PowerManagement', '/org/freedesktop/PowerManagement/Inhibit') dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit") cookie = dev.Inhibit('Nautilus', 'Copying files') time.sleep(100) dev.UnInhibit(cookie)
#!/usr/bin/python import dbus import time bus = dbus.Bus(dbus.Bus.TYPE_SESSION) devobj = bus.get_object('org.freedesktop.PowerManagement', '/org/freedesktop/PowerManagement/Inhibit') dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit") cookie = dev.Inhibit('Nautilus', 'Copying files') time.sleep(100) dev.UnInhibit(cookie)