X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=xsetbg.py;h=825b20eb0f9c927614a5285d4c8467524b3c5380;hb=080d6169f03836330b355e5304e51122d7956c11;hp=68828cf567b5db4c43875df9e5c36b737c02362d;hpb=8fedc324654b410682e313d2542726c8305b2b93;p=xsetbg.git diff --git a/xsetbg.py b/xsetbg.py index 68828cf..825b20e 100644 --- a/xsetbg.py +++ b/xsetbg.py @@ -50,11 +50,11 @@ if xsetbg_conf.has_option("xsetbg", "min_delay"): min_delay = xsetbg_conf.get("xsetbg", "min_delay") # Borrowed from http://stackoverflow.com/a/2765366 - td_re = re.compile('(?:(?P\d+)y)?' - '(?:(?P\d+)m)?' - '(?:(?P\d+)d)?' - '(?:T(?:(?P\d+)h)?' - '(?:(?P\d+)m)?(?:(?P\d+)s)?)?') + td_re = re.compile('(?:(?P\\d+)y)?' + '(?:(?P\\d+)m)?' + '(?:(?P\\d+)d)?' + '(?:T(?:(?P\\d+)h)?' + '(?:(?P\\d+)m)?(?:(?P\\d+)s)?)?') td_dict = td_re.match(min_delay).groupdict(0) delta = timedelta(days=int(td_dict['days']) + (int(td_dict['months']) * 30) + @@ -125,6 +125,16 @@ def change(force=False): "-center", "-onroot", "-quiet", "-zoom", "auto", row.full_name.encode(fs_encoding)] + ext = os.path.splitext(row.full_name)[1].lower() + if ext in ('tif', 'tiff'): + program_options[0] = 'xsetbg' + + if ext == 'webp': + program_options = ['display', '-backdrop', + '-background', random.choice(borders), + '-window', 'root', + row.full_name.encode(fs_encoding)] + rc = subprocess.call(program_options) if rc: error("cannot execute xli!")