<?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>Lindoze.net &#187; Linux</title>
	<atom:link href="http://blog.lindoze.net/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lindoze.net</link>
	<description>Lindoze.net Weblog</description>
	<lastBuildDate>Sat, 02 Aug 2008 12:15:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Linux: Change volume using multimedia keys</title>
		<link>http://blog.lindoze.net/software/linux-volume-multimedia-keys/</link>
		<comments>http://blog.lindoze.net/software/linux-volume-multimedia-keys/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 20:21:46 +0000</pubDate>
		<dc:creator>flo</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://blog.lindoze.net/?p=30</guid>
		<description><![CDATA[I was looking for a way to change the volume using the multimedia keys on my keyboard. There are quite a few programms that should do the job, but all of them where running as a daemon (background process). In my opinion this is unneccesary because I need to raise/lower/mute the volume only once in [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Example how it should look like" rel="lightbox[]" href="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/volume_0.png" rel="lightbox[30]"><img class="ngg-singlepic ngg-left" style="float: left;" src="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/thumbs/thumbs_volume_0.png" alt="Screenshot" /></a>I was looking for a way to change the volume using the multimedia keys on my keyboard. There are quite a few programms that should do the job, but all of them where running as a daemon (background process). In my opinion this is unneccesary because I need to raise/lower/mute the volume only once in a while. Therefore I wrote a quick&#8217;n'dirty bash script using ALSA&#8217;s <em>amixer</em> and the <em>osd_cat</em> utility.</p>
<p><span id="more-30"></span></p>
<h3>Features</h3>
<ul>
<li>Raise/Lower Volume</li>
<li>Mute/Unmute</li>
<li>Displays the current volume on-screen using <em>osd_cat</em></li>
</ul>
<h3>Usage</h3>
<p>Open the script file with your favourite editor edit following to lines to fit your needs:</p>
<pre>CONTROL="Front" CHANNEL="Front Left"</pre>
<p>CONTROL is used to set the volume and CHANNEL to get the current volume. Run <em>amixer</em> to see which is the right control and <em>amixer get YOUR-CONTROL</em> to select one channel listed there.</p>
<p><a title="Compiz Settings - General - Actions" rel="lightbox[]" href="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/compiz-general-actions.png" rel="lightbox[30]"><img class="ngg-left ngg-singlepic" style="float: left;" src="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/thumbs/thumbs_compiz-general-actions.png" alt="Compiz Settings - General - Actions" /></a>As I am using the <em>compiz-fusion</em> window manager along with the <em>XFCE</em> desktop I decided to use the built-in functions of compiz to bind the keys.</p>
<p style="text-align: center;"><a title="Compiz Settings - General - Actions" rel="lightbox[]" href="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/compiz-general-actions.png"><br />
</a></p>
<p><a title="Compiz Settings - General - Commands" rel="lightbox[]" href="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/compiz-general-commands.png" rel="lightbox[30]"><img class="ngg-right ngg-singlepic" style="float: right;" src="http://blog.lindoze.net/wp-content/gallery/linux-volume-multimedia-keys/thumbs/thumbs_compiz-general-commands.png" alt="Compiz Settings - General - Actions" /></a>In the <em>CompizConfig Settings Manager</em> select the <em>General Options</em> sub-dialog. Inside the <em>Commands</em> tab find three empty slots and bind them to:</p>
<pre><em>PATH-TO-THE-SCRIPT</em>/avolctrl.sh down <em>PATH-TO-THE-SCRIPT</em>/avolctrl.sh up <em>PATH-TO-THE-SCRIPT</em>/avolctrl.sh toggle</pre>
<p>Finally bind those command slots to your multimedia keys. For me these were:</p>
<pre>XF86AudioLowerVolume XF86AudioRaiseVolume XF86AudioMute</pre>
<h3>Prerequisites</h3>
<ul>
<li><em>amixer</em>: In <a title="Ubuntu" href="http://www.ubuntu.com" target="_blank">Ubuntu</a> you need to install the <strong>alsa-utils</strong> package.</li>
<li><em>osd_cat</em>: In <a title="Ubuntu" href="http://www.ubuntu.com" target="_blank">Ubuntu</a> you need to install the <strong>xosd-bin</strong> package. Source code can be downloaded from <a title="xosd" href="http://www.ignavus.net/software.html" target="_blank">http://www.ignavus.net/software.html</a>.</li>
</ul>
<p>For a different Linux distribution you need to find the appropriate packages your self or compile the binaries from the source code.</p>
<h3>Download</h3>
<ul>
<li><a href="http://blog.lindoze.net/wp-content/uploads/2008/03/avolctrl.sh">avolctrl.sh</a> (2 KiB, GPL)</li>
</ul>
<h3>Troubleshooting</h3>
<p>In case the keys don&#8217;t work, check if your keyboard sends events to the xserver using <em>xev</em>. Additionally you might have to define the keys properly using <em>xmodmap</em> if it does not work out-of-the-box. Following codes are working for me (Microsoft Comfort Curve Keyboard)</p>
<pre>keycode 160 = XF86AudioMute keycode 174 = XF86AudioLowerVolume keycode 176 = XF86AudioRaiseVolume</pre>
<h3>Known Bugs</h3>
<ul>
<li>No bugs known yet. As I said, very quick&#8217;n'dirty hack but should work anyway.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.lindoze.net/software/linux-volume-multimedia-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

