linux 桌面背景随心换

来源:互联网 发布:linux下安装jmeter 编辑:程序博客网 时间:2024/06/02 08:28

偶然间在网上找到了一百张美图~都是自然风景画。据说能养眼哦~地址请看这里

我的桌面背景也是该换换了,不过手工换这一百张可不好玩。windows下有桌面随心换这个现成的软件;kde下也自带这个功能。但我用的是gnome,找了半天还是没找到自带的功能。所以写了一个python脚本,让它隔10分钟换一张桌面背景。感觉好炫哈~

 

#!/usr/bin/env pythonBACKGROUND_DIRS = ['~/Picture/eyes', '~/Picture/backgrounds']import os, glob, random, itertools, gconffiles = list(itertools.chain(*[[os.path.join(dirpath, name)                                for name in filenames]                               for dirpath, dirnames, filenames in                               itertools.chain(*[os.walk(os.path.expanduser(d))                                                 for d in BACKGROUND_DIRS])]))gconf.client_get_default().set_string(    '/desktop/gnome/background/picture_filename',    random.choice(files))

我把它保存到 ~/bin/wallpaper.py。然后在crontab里加入

*/10 * * * * ~/bin/wallpaper.py

就可以隔10分钟换一次了~


版权声明

本人的所有原创文章皆保留版权,请尊重原创作品。
转载必须包含本声明,保持本文完整,并以超链接形式注明原始作者“redraiment”和主站点上的本文原始地址。

联系方式

我的邮箱,欢迎来信(redraiment@gmail.com)
我的Blogger(子清行)
我的Google Sites(子清行)
我的CSDN博客(梦婷轩)
我的百度空间(梦婷轩)

原创粉丝点击