早起,写一个变色的小程序

以前用Windows的时候,我是说用XP的时候,因为不支持颜色主题,也无从知晓如何通过自动化的方式更换Windows的主题,所以,经常是人肉地每天换主题(其实只是为了换标题栏的颜色),追求新鲜感。
现在用Gnome桌面以后依然保持着这种爱好。遗憾是之前一直没有找到设置存放的位置。前两天在command-line-fu上恰好看到一个变换桌面背景的命令,原来这类配置都存放在gconf里,用gconftool就可以进行操作了。
然后很容易地就能在图形化配置管理器里找到颜色配置的键值位于/desktop/gnome/interface/gtk_color_scheme,值是一个用换行符隔开的名值对,内容就是我们在Appearance配置窗口里看到的那些。good,写个shell小程序每天换颜色!
以下是我孱弱的shell脚本:
[codesyntax lang="bash" lines="fancy"]

case `date +%w` in
	0) color='#C4C4A0A00000';;
	1) color='#CECE5C5C0000';;
	2) color='#8F8F59590202';;
	3) color='#4E4E9A9A0606';;
	4) color='#20204A4A8787';;
	5) color='#5C5C35356666';;
	6) color='#A4A400000000';;
esac

sedcommand="s/\(selected_bg_color:\)\(.*\)/\1$color/"

color_scheme=`gconftool-2 -g /desktop/gnome/interface/gtk_color_scheme | sed $sedcommand`

gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "$color_scheme"

[/codesyntax]
每天一换,颜色是tango调色板里的色彩,HOHOHAHA

This entry was written by Sunng , posted on Tuesday May 05 2009at 09:05 am , filed under 把戏 and tagged , , . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

4 Responses to “早起,写一个变色的小程序”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word