<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>kurrunk &#187; openbox</title>
	<atom:link href="http://blog.kurrunk.com/archives/tag/openbox/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.kurrunk.com</link>
	<description>不停转圈的人</description>
	<lastBuildDate>Fri, 30 Dec 2011 12:06:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.kurrunk.com/?pushpress=hub'/>
		<item>
		<title>让Linux中的壁纸自动更新</title>
		<link>http://blog.kurrunk.com/archives/582</link>
		<comments>http://blog.kurrunk.com/archives/582#comments</comments>
		<pubDate>Thu, 17 Dec 2009 13:32:51 +0000</pubDate>
		<dc:creator>zhengquan</dc:creator>
				<category><![CDATA[色即是空]]></category>
		<category><![CDATA[1x.com]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[feh]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openbox]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[壁纸]]></category>

		<guid isPermaLink="false">http://blog.kurrunk.com/?p=582</guid>
		<description><![CDATA[我的linux桌面一直是黑漆漆的，有一年多没用壁纸了，今天心血来潮了。 1x.com的图片很漂亮，格调简单。 这文章写的就是怎么把1x.com的美图自动设置为自己的桌面，而且这是自动的。 有一点需要注意，1x.com的图片尺寸有限，如果你的显示分辨率大了可能显示效果不会很好（我的800&#215;600显示效果还不错）。 软件环境是：archlinux+openbox+feh。 写个PHP脚本 &#60;?php error_reporting(1); require_once 'simplepie.inc'; $feed = new SimplePie('http://1x.com/rss/rss.php', 'cache'); $i=0; $max = $feed->get_item_quantity(); $curl = curl_init(); while($iget_item($i); $url=$item->get_permalink(); $id=ereg_replace("^[^0-2&#124;4-9]+D","",$url); $fp = fopen('tmp-thumb.jpg', "w"); curl_setopt($curl, CURLOPT_FILE, $fp); curl_setopt($curl,CURLOPT_URL,"http://1x.com/pictures/$id-thumb.jpg"); curl_exec($curl); fclose($fp); $xy= getimagesize('tmp-thumb.jpg'); if($xy[0]>$xy[1]){ $fp = fopen('/home/kurrunk/kurrunk.well/1x.jpg', "w"); curl_setopt($curl, CURLOPT_FILE, $fp); curl_setopt($curl,CURLOPT_URL,"http://1x.com/OEfullSize/$id-fullsize.jpg"); curl_exec($curl); fclose($fp); break; } $i++; } curl_close($curl); ?&#62; 其中用到了rss解析工具“simplepie”，还有curl。 [...]]]></description>
			<content:encoded><![CDATA[<p>我的linux桌面一直是黑漆漆的，有一年多没用壁纸了，今天心血来潮了。</p>
<p>1x.com的图片很漂亮，格调简单。<br />
这文章写的就是怎么把1x.com的美图自动设置为自己的桌面，而且这是自动的。<br />
有一点需要注意，1x.com的图片尺寸有限，如果你的显示分辨率大了可能显示效果不会很好（我的800&#215;600显示效果还不错）。</p>
<p>软件环境是：archlinux+openbox+feh。</p>
<h4>写个PHP脚本</h4>
<p><code>&lt;?php<br />
error_reporting(1);<br />
require_once 'simplepie.inc';<br />
$feed = new SimplePie('http://1x.com/rss/rss.php', 'cache');<br />
$i=0;<br />
$max = $feed->get_item_quantity();<br />
$curl = curl_init();<br />
while($i<$max){<br />
	$item=$feed->get_item($i);<br />
	$url=$item->get_permalink();<br />
	$id=ereg_replace("^[^0-2|4-9]+D","",$url);<br />
      $fp = fopen('tmp-thumb.jpg', "w");<br />
	curl_setopt($curl, CURLOPT_FILE, $fp);<br />
	curl_setopt($curl,CURLOPT_URL,"http://1x.com/pictures/$id-thumb.jpg");<br />
	curl_exec($curl);<br />
	fclose($fp);<br />
	$xy= getimagesize('tmp-thumb.jpg');<br />
	if($xy[0]>$xy[1]){<br />
		$fp = fopen('/home/kurrunk/kurrunk.well/1x.jpg', "w");<br />
		curl_setopt($curl, CURLOPT_FILE, $fp);<br />
		curl_setopt($curl,CURLOPT_URL,"http://1x.com/OEfullSize/$id-fullsize.jpg");<br />
		curl_exec($curl);<br />
		fclose($fp);<br />
		break;<br />
	}<br />
	$i++;<br />
}<br />
curl_close($curl);<br />
?&gt;</code><br />
其中用到了rss解析工具“simplepie”，还有curl。<br />
把脚本保存到一个目录下。</p>
<h4>写个sh用来执行php脚本，并更新桌面</h4>
<p>shell文件的内容是：<br />
<code>export DISPLAY=:0.0<br />
feh --bg-scale ~/kurrunk.well/1x.jpg<br />
php ~/dwell/uw.php</code>上面的路径根据具体情况设置。</p>
<p>增加可执行属性:<br />
<code>$chmod +x kurrunk.scripts/well.sh</code></p>
<h4>加入计划任务中</h4>
<p>创建cron文件，内容为：<br />
<code>0 */2 * * * kurrunk.scripts/well.sh</code>这里任务间隔是2个小时。</p>
<p>激活crontab：<br />
<code>$sudo -u kurrunk crontab kurrunk.scripts/well.cron</code></p>
<p>查看任务是不是加入了：<br />
<code>$sudo -u kurrunk crontab -l</code></p>
<h4>开机更新壁纸</h4>
<p>这个如果不设置的话，初开机时可能是没有壁纸的。</p>
<p>在.config/openbox/autostart.sh加入：<br />
<code>kurrunk.scripts/well.sh</code><br />
如果要求不高的话也没必要设置计划任务，开机时更新一次就好了。</p>
<p>题外话：本来想用python写的，两分钟过去我没有反应，明白了自己已经把python忘的差不多了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kurrunk.com/archives/582/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>我的linux桌面换成了xfce4</title>
		<link>http://blog.kurrunk.com/archives/183</link>
		<comments>http://blog.kurrunk.com/archives/183#comments</comments>
		<pubDate>Tue, 17 Mar 2009 01:04:18 +0000</pubDate>
		<dc:creator>zhengquan</dc:creator>
				<category><![CDATA[色即是空]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openbox]]></category>
		<category><![CDATA[xfce4]]></category>
		<category><![CDATA[桌面]]></category>
		<category><![CDATA[软件]]></category>

		<guid isPermaLink="false">http://www.phecda.org/blog/?p=183</guid>
		<description><![CDATA[我家里用的电脑和单位用的电脑都装着linux系统。 家里电脑配置是amd64 2800+、768内存、80G硬盘，经常运行的占用内存较多的软件有firefox和eclipse，不敢用gnome等窗口管理工具，一直以来都是openbox+fbpanel+rox+ruxvt，自己再定制几个快键，效率还算不错，并且内存占用极低，最重要的是还很稳定。 单位的电脑一开始也被我安装了同样的软件(openbox+fbpanel+&#8230;)，运行了大约有四五个月的时间，昨天换用了xfce4，原因是这台电脑配置不低(4G内存)，是不是不应该死盯着内存来选择软件，xfce4是个介于gnome和openbox之间的软件，“体积、美观、易用”被xfce4平衡的似乎很适合我这台电脑。 附桌面截图一张：]]></description>
			<content:encoded><![CDATA[<p>我家里用的电脑和单位用的电脑都装着linux系统。</p>
<p>家里电脑配置是amd64 2800+、768内存、80G硬盘，经常运行的占用内存较多的软件有firefox和eclipse，不敢用gnome等窗口管理工具，一直以来都是openbox+fbpanel+rox+ruxvt，自己再定制几个快键，效率还算不错，并且内存占用极低，最重要的是还很稳定。</p>
<p>单位的电脑一开始也被我安装了同样的软件(openbox+fbpanel+&#8230;)，运行了大约有四五个月的时间，昨天换用了xfce4，原因是这台电脑配置不低(4G内存)，是不是不应该死盯着内存来选择软件，xfce4是个介于gnome和openbox之间的软件，“体积、美观、易用”被xfce4平衡的似乎很适合我这台电脑。</p>
<p>附桌面截图一张：<br />
<a href="http://picasaweb.google.com/lh/photo/YCM4cwWKjKB4_TH5SowYxA?feat=embedwebsite"><img src="http://lh6.ggpht.com/_sSlOa6svSLk/Sb7yL5RgqDI/AAAAAAAAAMg/J85GPRRCSe4/s144/2009-03-17-083642_1366x768_scrot.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kurrunk.com/archives/183/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

