<?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>WebFramp &#187; arch</title>
	<atom:link href="http://www.webframp.com/tag/arch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webframp.com</link>
	<description>passing thoughts on the web</description>
	<lastBuildDate>Thu, 17 Sep 2009 19:34:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Switch+dzen</title>
		<link>http://www.webframp.com/2008/08/17/switchdzen/</link>
		<comments>http://www.webframp.com/2008/08/17/switchdzen/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 08:23:15 +0000</pubDate>
		<dc:creator>sean</dc:creator>
				<category><![CDATA[musings]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[dzen]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.webframp.com/?p=41</guid>
		<description><![CDATA[Well Ubunut Intrepid may turn out to be great, but the recent ubuntu upgrade on my part proved to me how tired I was of dealing with apt and it&#8217;s pkg management system. How many debian users actually know what it&#8217;s really doing? So I switched. To Arch. Lately it seems like every useful tip [...]]]></description>
			<content:encoded><![CDATA[<p>Well Ubunut Intrepid may turn out to be great, but the recent ubuntu upgrade on my part proved to me how tired I was of dealing with apt and it&#8217;s pkg management system. How many debian users actually know what it&#8217;s really doing?</p>
<p>So I switched. To Arch.</p>
<p>
Lately it seems like every useful tip I&#8217;ve gleaned has been from either the gentoo or arch wiki, so I had narrowed it down to one of the two. Both are appealing for their BSD style init systems and simple script based pacakge systems. Gentoo is full source though which, while not really a negative for most modern systems, was something I didn&#8217;t want to be restricted to. Arch allows a flexible binary or source build system, although the actual repo&#8217;s are binary. I love the rolling kernel too, no more waiting 6 months to get the latest, risking a broken system by upgrading in between.
</p>
<p>
In the process of switching I have fine-tuned things to the extreme. One of the tweaks is the battery status bar I use. It&#8217;s just a simple shell script that outputs formatted text to dzen2. It always bugged me that the script didn&#8217;t notice the charging state. After a simple little change, it does.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># original script by lyon8 &amp;lt;lyon8@gmx.net&amp;gt;</span>
<span style="color: #666666; font-style: italic;"># modifications from original by &amp;lt;sean.escriva@gmail.com&amp;gt;</span>
<span style="color: #666666; font-style: italic;"># show your laptop battery state in dzen</span>
&nbsp;
<span style="color: #007800;">BG</span>=<span style="color: #ff0000;">'#1c2636'</span>  <span style="color: #666666; font-style: italic;"># dzen backgrounad</span>
<span style="color: #007800;">FG</span>=<span style="color: #ff0000;">'#99ffff'</span>  <span style="color: #666666; font-style: italic;"># dzen foreground</span>
<span style="color: #007800;">W</span>=<span style="color: #000000;">150</span>         <span style="color: #666666; font-style: italic;"># width of the dzen bar</span>
<span style="color: #007800;">GW</span>=<span style="color: #000000;">50</span>         <span style="color: #666666; font-style: italic;"># width of the gauge</span>
<span style="color: #007800;">GFG</span>=<span style="color: #ff0000;">'#33ccff'</span>  <span style="color: #666666; font-style: italic;"># color of the gauge</span>
<span style="color: #007800;">GH</span>=<span style="color: #000000;">7</span>          <span style="color: #666666; font-style: italic;"># height of the gauge</span>
<span style="color: #007800;">GBG</span>=<span style="color: #ff0000;">'#333'</span>    <span style="color: #666666; font-style: italic;"># color of gauge background</span>
<span style="color: #007800;">X</span>=<span style="color: #000000;">1770</span>        <span style="color: #666666; font-style: italic;"># x position</span>
<span style="color: #007800;">Y</span>=<span style="color: #000000;">1200</span>        <span style="color: #666666; font-style: italic;"># y position</span>
<span style="color: #007800;">FN</span>=<span style="color: #ff0000;">'snap'</span>     <span style="color: #666666; font-style: italic;"># font</span>
&nbsp;
<span style="color: #007800;">STATEFILE</span>=<span style="color: #ff0000;">'/proc/acpi/battery/BAT0/state'</span> <span style="color: #666666; font-style: italic;"># battery's state file</span>
<span style="color: #007800;">INFOFILE</span>=<span style="color: #ff0000;">'/proc/acpi/battery/BAT0/info'</span>   <span style="color: #666666; font-style: italic;"># battery's info file</span>
&nbsp;
<span style="color: #007800;">LOWBAT</span>=<span style="color: #000000;">25</span>        <span style="color: #666666; font-style: italic;"># percentage of battery life marked as low</span>
<span style="color: #007800;">LOWCOL</span>=<span style="color: #ff0000;">'#ff4747'</span> <span style="color: #666666; font-style: italic;"># color when battery is low</span>
<span style="color: #007800;">CHGCOL</span>=<span style="color: #ff0000;">'#60da11'</span> <span style="color: #666666; font-style: italic;"># color when battery is charging</span>
<span style="color: #007800;">TIME_INT</span>=<span style="color: #000000;">1</span>       <span style="color: #666666; font-style: italic;"># time intervall in seconds</span>
&nbsp;
<span style="color: #007800;">PREBAR</span>=<span style="color: #ff0000;">'^i(/home/webframp/.dzen/icons/dzen_bitmaps/battery.xbm) '</span> <span style="color: #666666; font-style: italic;"># caption (also icons are possible)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #666666; font-style: italic;"># look up battery's data</span>
<span style="color: #007800;">BAT_FULL</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$INFOFILE</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> design<span style="color: #000000; font-weight: bold;">|</span>line<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">11</span><span style="color: #000000; font-weight: bold;">`</span>;
<span style="color: #007800;">STATUS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$STATEFILE</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> charging<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">12</span><span style="color: #000000; font-weight: bold;">`</span>;
<span style="color: #007800;">RCAP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$STATEFILE</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> remaining<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">`</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># calculate remaining power</span>
<span style="color: #007800;">RPERCT</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$RCAP</span> \<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">`</span>;
<span style="color: #007800;">RPERC</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$RPERCT</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #007800;">$BAT_FULL</span><span style="color: #000000; font-weight: bold;">`</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># draw the bar and pipe everything into dzen</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RPERC</span> <span style="color: #660033;">-le</span> <span style="color: #007800;">$LOWBAT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #007800;">GFG</span>=<span style="color: #007800;">$LOWCOL</span>;
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$STATUS</span> = <span style="color: #ff0000;">'charging'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #007800;">GFG</span>=<span style="color: #007800;">$CHGCOL</span>;
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #007800;">GFG</span>=<span style="color: #ff0000;">'#33ccff'</span>;
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">#echo -n $PREBAR #uncomment for an icon</span>
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$RPERC</span> <span style="color: #000000; font-weight: bold;">|</span> gdbar <span style="color: #660033;">-h</span> <span style="color: #007800;">$GH</span> <span style="color: #660033;">-w</span> <span style="color: #007800;">$GW</span> <span style="color: #660033;">-fg</span> <span style="color: #007800;">$GFG</span> <span style="color: #660033;">-bg</span> <span style="color: #007800;">$GBG</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$TIME_INT</span>;
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">|</span> dzen2 <span style="color: #660033;">-ta</span> c <span style="color: #660033;">-tw</span> <span style="color: #007800;">$W</span> <span style="color: #660033;">-y</span> <span style="color: #007800;">$Y</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">$X</span> <span style="color: #660033;">-fg</span> <span style="color: #007800;">$FG</span> <span style="color: #660033;">-bg</span> <span style="color: #007800;">$BG</span> <span style="color: #660033;">-fn</span> <span style="color: #007800;">$FN</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.webframp.com/2008/08/17/switchdzen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
