X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=xsetbg.py;h=472196690efecb018e87de06a9c802e232adcaef;hb=ec40913c91abd535e9197d608c0861a9701dcfb2;hp=3b3b02f045c109a13c69141bcffb625ece9cff14;hpb=52bbc04408504708b97dcde0411859acc7882c98;p=xsetbg.git diff --git a/xsetbg.py b/xsetbg.py index 3b3b02f..4721966 100755 --- a/xsetbg.py +++ b/xsetbg.py @@ -1,16 +1,19 @@ #! /usr/local/bin/python -O -"""Select a random image from $HOME/lib/xsetbg/images subdirectories -and set it as the desktop wallpaper (display it in the root window). +"""Set a random background image (XWin) + +Select a random image from a (list of) directory(s) +and set it as the desktop wallpaper (display it in the root window) +using xli or xsetbg programs. -Author: Oleg BroytMann -Copyright (C) 2000-2006 PhiloSoft Design """ __version__ = "$Revision$"[11:-2] +__revision__ = "$Id$"[5:-2] +__date__ = "$Date$"[7:-2] + __author__ = "Oleg BroytMann " __copyright__ = "Copyright (C) 2000-2006 PhiloSoft Design" -__date__ = "$Date$"[7:-2] -__revision__ = "$Id$"[5:-2] +__license__ = "GNU GPL" import sys, os @@ -121,7 +124,18 @@ except anydbm.error, msg: os.remove(global_db_name) global_db = shelve.open(global_db_name, flag='c') -global_db.close() # Close DB in parent process +# Remove old filenames +old_time = time() - min_delay + +to_delete = [] +for key in global_db.keys(): + if key.startswith('/') and global_db[key] < old_time: + to_delete.append(key) + +for key in to_delete: + del global_db[key] + +global_db.close() # Close DB in the parent process # DB keys