/usr/lib/gdesklets/utils/BGWatcher.py is in gdesklets 0.36.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | from Observable import Observable
import wallpaper
import gobject
import time
#
# Class for reporting when the wallpaper image has changed.
#
class BGWatcher(Observable):
OBS_CHANGE_BG = 0
def __init__(self):
self.__old_bg = 0
self.__last_update = 0.0
gobject.timeout_add(50, self.__check_bg)
def __check_bg(self):
try:
ident = wallpaper.get_wallpaper_id()
if (ident != self.__old_bg):
self.__last_update = time.time()
gobject.timeout_add(500, self.__notify_update,
self.__last_update)
self.__old_bg = ident
except StandardError:
if (self.__old_bg):
self.__last_update = time.time()
gobject.timeout_add(500, self.__notify_update,
self.__last_update)
self.__old_bg = 0
return True
def __notify_update(self, timestamp):
if (timestamp != self.__last_update): return True
self.update_observer(self.OBS_CHANGE_BG)
return False
|