<?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>Nepherte (dot) be &#187; Tutorials</title>
	<atom:link href="http://www.nepherte.be/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nepherte.be</link>
	<description>About Nepherte, Mosiah and the person behind</description>
	<lastBuildDate>Sun, 30 May 2010 18:20:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Howto: Step by Step Configuration of XMonad</title>
		<link>http://www.nepherte.be/howto-step-by-step-configuration-of-xmonad/</link>
		<comments>http://www.nepherte.be/howto-step-by-step-configuration-of-xmonad/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 11:14:30 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=821</guid>
		<description><![CDATA[After months of false announcements on my behalf, I finally finished up writing my XMonad configuration tutorial. Since not everyone uses XMonad, let alone has ever heard of it, Here&#8217;s a brief introduction: XMonad is a dynamically tiling X11 window manager, written and configured in Haskell. Tiling window managers arrange windows in nonoverlapping tiled patterns [...]]]></description>
			<content:encoded><![CDATA[<p>After months of false announcements on my behalf, I finally finished up writing my XMonad configuration tutorial. Since not everyone uses XMonad, let alone has ever heard of it, Here&#8217;s a brief introduction: <a href="http://www.xmonad.org">XMonad</a> is a dynamically tiling X11 window manager, written and configured in <a href="http://www.haskell.org/">Haskell</a>. Tiling window managers arrange windows in nonoverlapping tiled patterns and strive to make it possible for the user to productively manage windows without the use of the mouse.</p>
<p>While many tiling window managers come with a rather simple configuration file, Haskell, a <a href="http://en.wikipedia.org/wiki/Lambda_calculus">λ-calculus</a> based functional programming language, lifts up XMonad up to one of the most extendible and finest window manager around. And therein lies &#8220;the problem&#8221;. Haskell is not what you would call a programming language used by regular folks (if regular folks actually know a programming language) nor does its syntax resemble to Java or C.</p>
<p>This guide will lead you step by step through the process of configuring XMonad. I will take my own config file as example. A lot of this can also be found scattered over the xmonad homepage. I&#8217;v taken the liberty to bundle all the information.</p>
<h5>Table of Contents</h5>
<ul>
<li><a href="#working_directory">1. The working directory</a></li>
<li><a href="#basic_config">2. The basic configuration</a></li>
<li><a href="#default_terminal">3. The default terminal</a></li>
<li><a href="#define_workspaces">4. Workspaces</a></li>
<li><a href="#attach_applications">5. Attaching applications to workspaces</a></li>
<li><a href="#define_floating_windows">6. Floating windows</a></li>
<li><a href="#tiling_layouts">7. Tiling layouts</a></li>
<li><a href="#key_combinations">8. Key combinations</a></li>
<li><a href="#status_bar">9. A status bar</a></li>
</ul>
<h5><a name="working_directory">The working directory</a></h5>
<p>The main working directory, where the configuration is done, where logs are stored and where the compiled binary is placed, is located at /home/&lt;username&gt;/.xmonad. The 2 most important files for this guide are xmonad.hs and xmonad.error. Configuration is done in the first one and errors are spit out in the last one. So if there is problem with compiling the config file, look at xmonad.error first. All the code snippets I&#8217;ll be posting have to be put in xmonad.hs. Mind you, I will only mention the code related to the section it is under. You should be capable of putting it all together or simply use my entire config file.</p>
<h5><a name="basic_config">The basic configuration</a></h5>
<p>A working configuration could be as easy as</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> defaultConfig</pre></div></div>

<p>It basically runs xmonad with the default configuration file (<em>defaultConfig</em>), found <a title="XMonad Template Config" href="http://haskell.org/haskellwiki/Xmonad/Config_archive/Template_xmonad.hs_%280.8%29">here</a>. Note that you don&#8217;t have to actually download the template config file I linked to. Everything is already included in the XMonad installation. However, you can use the file as your xmonad.hs and you&#8217;ll end up with the same result.</p>
<p>Xmonad provides a few basic Desktop Environment (DE) integration configurations you could use: Gnome (<em>gnomeConfig</em>), KDE (<em>kdeConfig</em>) and XFCE (<em>xfceConfig</em>). Each DE config file will gracefully handle the panels inherent to the DE, shortcut keys, etc. In short you&#8217;ll be running your DE as always but the window manager is replaced with XMonad. Since I favor Gnome, we&#8217;ll use this instead of the default config. Note that you are not required to use a DE at all, even if you are using a DE specific config.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig</pre></div></div>

<p>From now on, we will override and extend the gnome configuration step by step until we have the setup we want.</p>
<h5><a name="default_terminal">The default terminal</a></h5>
<p>You&#8217;ll probably use the terminal a lot so it is always nice to use the terminal program you prefer. In this example, I use gnome-terminal with a customized profile for XMonad.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define terminal</span>
myTerminal <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;gnome-terminal --window-with-profile=XMonad&quot;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
	  terminal  <span style="color: #339933; font-weight: bold;">=</span> myTerminal
	<span style="color: green;">&#125;</span></pre></div></div>

<p>You can consider the variable <em>terminal</em> as a sort of setting/property which we now have overrided with <em>myTerminal</em>. Feel free to replace <em>myTerminal</em> with the one you prefer.</p>
<h5><a name="define_workspaces">Workspaces</a></h5>
<p>Just as is the case with a desktop environment, XMonad can make use of workspaces and I encourage you to use them extensively. This is how you define workspaces:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define amount and names of workspaces</span>
myWorkspaces <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;1:main&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;2:web&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;3:chat&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;4:media&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;5:graph&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;6:browse&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;7:dev&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;8:mail&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
	  workspaces  <span style="color: #339933; font-weight: bold;">=</span> myWorkspaces
	<span style="color: green;">&#125;</span></pre></div></div>

<h5><a name="attach_applications">Attaching applications to workspaces</a></h5>
<p>Workspaces are a great way to separate types of programs from one another. As the names of my workspaces suggest, I prefer for example that development, web and multimedia applications don&#8217;t get mixed up with eachother. As opposed to a regular floating window manager, you don&#8217;t have to put the applications on the workspaces yourself. You can tell xmonad to do it for you instead. Here&#8217;s an example for 2 workspaces:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
<span style="color: #06c; font-weight: bold;">import</span> <span style="color: #06c; font-weight: bold;">qualified</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>StackSet <span style="color: #06c; font-weight: bold;">as</span> W
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define amount and names of workspaces</span>
myWorkspaces <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;1:main&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;2:web&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;3:chat&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;4:media&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;5:graph&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;6:browse&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;7:dev&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;8:mail&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define the workspace an application has to go to</span>
myManageHook <span style="color: #339933; font-weight: bold;">=</span> composeAll <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">concat</span> <span style="color: #339933; font-weight: bold;">$</span>
            <span style="color: green;">&#91;</span> <span style="color: #5d478b; font-style: italic;">-- The applications that go to web</span>
              <span style="color: green;">&#91;</span> className <span style="color: #339933; font-weight: bold;">=?</span> b <span style="color: #5d478b; font-style: italic;">--&amp;gt; doF (W.shift &quot;2:web&quot;) | b &amp;lt; - myClassWebShifts]</span>
              <span style="color: #5d478b; font-style: italic;">-- The applications that go to chat</span>
            <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span> className <span style="color: #339933; font-weight: bold;">=?</span> c <span style="color: #5d478b; font-style: italic;">--&amp;gt; doF (W.shift &quot;3:chat&quot;) | c &amp;lt; - myClassChatShifts]</span>
            <span style="color: green;">&#93;</span>
		<span style="color: #06c; font-weight: bold;">where</span>
	          myClassWebShifts    <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Firefox&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;Filezilla&quot;</span><span style="color: green;">&#93;</span>
		  myClassChatShifts   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;emesene&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;Xchat&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
	    workspaces  <span style="color: #339933; font-weight: bold;">=</span> myWorkspaces
	  <span style="color: #339933; font-weight: bold;">,</span> manageHook  <span style="color: #339933; font-weight: bold;">=</span> myManageHook
	<span style="color: green;">&#125;</span></pre></div></div>

<p>This will place firefox and filezilla on the &#8220;2:web&#8221; workspace while emesene and xchat are put on the &#8220;3:chat&#8221; workspace. There are a few ways you can catch an application: class names (<em>className</em>) and title names (<em>title</em>). To figure out what the application&#8217;s class or title name is, you can run xprop in a console and click on the app you want to grab the info from.</p>
<p>Due to some encoding issue &lt;- is displayed as &lt; &#8211; near the variables <em>b</em> and <em>c</em>. Make sure to remove the space between them.</p>
<h5><a name="define_floating_windows">Floating windows</a></h5>
<p>By default, XMonad will tile all windows. Occasionally you don&#8217;t want to tile a certain application because it just gets too messy. The classic examples are MPlayer and GIMP. If you let xmonad tile mplayer, the aspect ratio&#8217;s of your movies are ruined and GIMP just has too many tool aid boxes which would normally get tiled just like all other windows. You will need to add them to <em>myManageHook</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define the workspace an application has to go to</span>
myManageHook <span style="color: #339933; font-weight: bold;">=</span> composeAll <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">concat</span> <span style="color: #339933; font-weight: bold;">$</span>
            <span style="color: green;">&#91;</span>  <span style="color: #5d478b; font-style: italic;">-- The applications that float</span>
              <span style="color: green;">&#91;</span> className <span style="color: #339933; font-weight: bold;">=?</span> i <span style="color: #5d478b; font-style: italic;">--&amp;gt; doFloat | i &amp;lt; - myClassFloats]</span>
            <span style="color: green;">&#93;</span>
		<span style="color: #06c; font-weight: bold;">where</span>
		  myClassFloats	      <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Gnome-mplayer&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;MPlayer&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run XMonad</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
	    manageHook  <span style="color: #339933; font-weight: bold;">=</span> myManageHook
	<span style="color: green;">&#125;</span></pre></div></div>

<p>In this example, mplayer and gnome-mplayer will not be tiled but floated instead.</p>
<h5><a name="tiling_layouts">Tiling layouts</a></h5>
<p>There are multiple tiling layouts available, or more specifically, the way your windows will be arranged. The 4 most commonly used layouts are Tall, Full, SimpleFloat and Mirror Tall. But first some further explanation about tiling layouts.</p>
<p>Most layouts have a master pane and one or more slave panes. When you start your first application window, it will open up fully maximized. When opening other application windows, the latest launched application will be placed in the master pane. Every other window will be reorganized, resized and placed in the slave pane(s) according to the used tiling algorithm. That&#8217;s the principle of tiling. Now, you can surely think of a few ways how these master and slave panes can be organized and that&#8217;s where the layouts kick in. A possible organization of these panes is called a layout.</p>
<ul>
<li>Tall is a layout with 2 columns of which the size ratio can be defined by the user. You can set the maximum number of windows in the master pane, which occupies the left part of the screen. In each pane, the windows are organized vertically.</li>
<li> Full is the layout where each application window will occupy the whole screen. The most current one will be shown, all the others will be hidden behind the current one.</li>
<li>SimpleFloat is a layout where all windows are put in float mode. Each window also gets a small title bar.</li>
<li>Mirror Tall is similar to Tall but it uses rows instead of columns and windows are organized horizontally in each pane.</li>
</ul>
<p>This is how you set the 4 layouts I&#8217;ve mentioned:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">--import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Layout<span style="color: #339933; font-weight: bold;">.</span>SimpleFloat
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define default layouts used on most workspaces</span>
defaultLayouts <span style="color: #339933; font-weight: bold;">=</span> tiled <span style="color: #339933; font-weight: bold;">|||</span> Mirror tiled <span style="color: #339933; font-weight: bold;">|||</span> simpleFloat <span style="color: #339933; font-weight: bold;">|||</span> Full
  <span style="color: #06c; font-weight: bold;">where</span>
       <span style="color: #5d478b; font-style: italic;">-- default tiling algorithm partitions the screen into two panes</span>
          tiled   <span style="color: #339933; font-weight: bold;">=</span> Tall nmaster delta ratio
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- The default number of windows in the master pane</span>
          nmaster <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span>
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- Default proportion of screen occupied by master pane</span>
          ratio   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">2</span>
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- Percent of screen to increment by when resizing panes</span>
          delta   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">100</span>
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
		layoutHook  <span style="color: #339933; font-weight: bold;">=</span> defaultLayouts
	<span style="color: green;">&#125;</span></pre></div></div>

<p>These layouts apply to all your workspaces. You could also set one or more layouts for one specific workspace with <em>onWorkspace</em>. The next example will only set the Full layout for the &#8220;4:media&#8221; workspace. With the <em>noBorders</em> option, we remove the borders around a window (the ones you get when a window is active).</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">--import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Layout<span style="color: #339933; font-weight: bold;">.</span>SimpleFloat
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Layout<span style="color: #339933; font-weight: bold;">.</span>NoBorders <span style="color: green;">&#40;</span>noBorders<span style="color: green;">&#41;</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Layout<span style="color: #339933; font-weight: bold;">.</span>PerWorkspace <span style="color: green;">&#40;</span>onWorkspace<span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define default layouts used on most workspaces</span>
defaultLayouts <span style="color: #339933; font-weight: bold;">=</span> tiled <span style="color: #339933; font-weight: bold;">|||</span> Mirror tiled <span style="color: #339933; font-weight: bold;">|||</span> simpleFloat <span style="color: #339933; font-weight: bold;">|||</span> Full
  <span style="color: #06c; font-weight: bold;">where</span>
       <span style="color: #5d478b; font-style: italic;">-- default tiling algorithm partitions the screen into two panes</span>
          tiled   <span style="color: #339933; font-weight: bold;">=</span> Tall nmaster delta ratio
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- The default number of windows in the master pane</span>
          nmaster <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span>
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- Default proportion of screen occupied by master pane</span>
          ratio   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">2</span>
&nbsp;
       <span style="color: #5d478b; font-style: italic;">-- Percent of screen to increment by when resizing panes</span>
          delta   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">3</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">100</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define layout for specific workspaces</span>
mediaLayout <span style="color: #339933; font-weight: bold;">=</span> noBorders <span style="color: #339933; font-weight: bold;">$</span> Full
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Put all layouts together</span>
myLayouts <span style="color: #339933; font-weight: bold;">=</span> onWorkspace <span style="background-color: #3cb371;">&quot;media&quot;</span> mediaLayout <span style="color: #339933; font-weight: bold;">$</span> defaultLayouts
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
		layoutHook  <span style="color: #339933; font-weight: bold;">=</span> myLayouts
	<span style="color: green;">&#125;</span></pre></div></div>

<h5><a name="key_combinations">Key combinations</a></h5>
<p>XMonad can be controlled by the keyboard without the use of a mouse whatsoever. Not only is it very useful to know the most important key combinations in XMonad, but it is also a good idea to create new key combinations to facilitate your work in XMonad.That way you don&#8217;t have to open up a terminal every time you want to do something.</p>
<p>In XMonad you can add new key combinations, redefine and remove existing ones. Let us first define the new keys we want to add. The format in which you define new keys is</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>key<span style="color: #339933; font-weight: bold;">_</span>modifier<span style="color: #339933; font-weight: bold;">,</span> key<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> action<span style="color: green;">&#41;</span></pre></div></div>

<p>If you don&#8217;t want to use a key modifier you can use 0. If you want a combination of key modifiers, you can combine them with .|. You can find an exhaustive list of keys <a href="http://haskell.org/haskellwiki/Xmonad/Key_codes">here</a>. If you are unshure about the value of a key, you can use the xev command that prints all the information of a pressed key in the terminal. Prefix that value witk xK_ or simply use the key code, which can be useful for multimedia keys such as play/volume up &amp; down/mute/media player/&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Util<span style="color: #339933; font-weight: bold;">.</span>Run
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Actions<span style="color: #339933; font-weight: bold;">.</span>CycleWS
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Define keys to add</span>
keysToAdd x     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span> <span style="color: #5d478b; font-style: italic;">-- Gnome run dialog</span>
                       <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>F2<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;/home/bart/.run/run.py --interface=full&quot;</span><span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Gnome close window</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>F4<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> kill<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Shift to previous workspace</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>Left<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> prevWS<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Shift to next workspace</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>Right<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> nextWS<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Shift window to previous workspace</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> shiftMask<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>Left<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> shiftToPrev<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Shift window to next workspace</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> shiftMask<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>Right<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> shiftToNext<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Mute volume</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: red;">0</span><span style="color: #339933; font-weight: bold;">,</span>0x1008ff12<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;amixer -Dpulse set Master toggle&quot;</span><span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Launch mpd</span>
                    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: red;">0</span><span style="color: #339933; font-weight: bold;">,</span>0x1008ff32<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;mpd&quot;</span><span style="color: green;">&#41;</span>
                  <span style="color: green;">&#93;</span></pre></div></div>

<p>Next you need to define the keys you want to remove. You only have to specify the key combination and not the action it performs. An example</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">keysToRemove x  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span> <span style="color: #5d478b; font-style: italic;">-- Old run dialog binding</span>
                       <span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>p<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Old close window binding</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span>modMask x<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>c<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Unused gmrun binding</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> shiftMask<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>p<span style="color: green;">&#41;</span>
                    <span style="color: #5d478b; font-style: italic;">-- Unused gnome session logout dialog</span>
                    <span style="color: #339933; font-weight: bold;">,</span>  <span style="color: green;">&#40;</span>modMask x <span style="color: #339933; font-weight: bold;">.|.</span> shiftMask<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>q<span style="color: green;">&#41;</span>
                  <span style="color: green;">&#93;</span></pre></div></div>

<p>Last thing remaining is putting it all together.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- Import statements</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
<span style="color: #06c; font-weight: bold;">import</span> <span style="color: #06c; font-weight: bold;">qualified</span> Data<span style="color: #339933; font-weight: bold;">.</span>Map <span style="color: #06c; font-weight: bold;">as</span> M
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Merge keys to add and existing keys</span>
newKeys x       <span style="color: #339933; font-weight: bold;">=</span> M<span style="color: #339933; font-weight: bold;">.</span>union <span style="color: green;">&#40;</span>keys gnomeConfig x<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>M<span style="color: #339933; font-weight: bold;">.</span>fromList <span style="color: green;">&#40;</span>keysToAdd x<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Delete the keys to remove from existing keys</span>
myKeys x        <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">foldr</span> M<span style="color: #339933; font-weight: bold;">.</span>delete <span style="color: green;">&#40;</span>newKeys x<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>keysToRemove x<span style="color: green;">&#41;</span>
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
	xmonad <span style="color: #339933; font-weight: bold;">$</span> gnomeConfig <span style="color: green;">&#123;</span>
		keys <span style="color: #339933; font-weight: bold;">=</span> myKeys
	<span style="color: green;">&#125;</span></pre></div></div>

<h5><a name="status_bar">Status bar</a></h5>
<p>A status bar always comes in handy: to know what workspace you are on, in what workspace there are still windows, to display conky stats, time &amp; date, the current song you are listening too, &#8230; XMonad nicely integrates with xmobar and dzen2. In this tutorial, I&#8217;ll be using 2 dzen2 status bars. Make sure you have dzen2 and conky installed. First we specify the commands that launches the dzen2 status bars.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">myStatusBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;dzen2 -x '0' -y '0' -h '24' -w '960' -ta 'l' -fg '#FFFFFF' -bg '#000000' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'&quot;</span>
conkyStatsBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;conky -c .conkyrc_console | dzen2 -x '960' -y '0' -h '24' -w '890' -ta 'l' -fg '#3EB5FF' -bg '#000000' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'&quot;</span></pre></div></div>

<p>You can adapt the commands to suit your needs. Set the horizontal, vertical positions and alignment of the bars with the -x, -y, -ta switches. Use the -c switch in conky to specify the conky file to run. For more information see the dzen2 manual pages.</p>
<p>Now you can format the status bars with the dynamicLogHook XMonad library.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Hooks<span style="color: #339933; font-weight: bold;">.</span>DynamicLog
<span style="color: #06c; font-weight: bold;">import</span> System<span style="color: #339933; font-weight: bold;">.</span><span style="color: #cccc00; font-weight: bold;">IO</span>
&nbsp;
myLogHook <span style="color: #339933; font-weight: bold;">::</span> Handle <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; X <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
myLogHook h <span style="color: #339933; font-weight: bold;">=</span> dynamicLogWithPP <span style="color: #339933; font-weight: bold;">$</span> defaultPP
    <span style="color: green;">&#123;</span>
        ppCurrent           <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;#3EB5FF&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> pad
      <span style="color: #339933; font-weight: bold;">,</span> ppVisible           <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;white&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> pad
      <span style="color: #339933; font-weight: bold;">,</span> ppHidden            <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;white&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> pad
      <span style="color: #339933; font-weight: bold;">,</span> ppHiddenNoWindows   <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;#444444&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> pad
      <span style="color: #339933; font-weight: bold;">,</span> ppUrgent            <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;red&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> pad
      <span style="color: #339933; font-weight: bold;">,</span> ppWsSep             <span style="color: #339933; font-weight: bold;">=</span>   <span style="background-color: #3cb371;">&quot; &quot;</span>
      <span style="color: #339933; font-weight: bold;">,</span> ppSep               <span style="color: #339933; font-weight: bold;">=</span>   <span style="background-color: #3cb371;">&quot;  |  &quot;</span>
      <span style="color: #339933; font-weight: bold;">,</span> ppTitle             <span style="color: #339933; font-weight: bold;">=</span>   <span style="color: green;">&#40;</span><span style="background-color: #3cb371;">&quot; &quot;</span> <span style="color: #339933; font-weight: bold;">++</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">.</span> dzenColor <span style="background-color: #3cb371;">&quot;white&quot;</span> <span style="background-color: #3cb371;">&quot;black&quot;</span> <span style="color: #339933; font-weight: bold;">.</span> dzenEscape
      <span style="color: #339933; font-weight: bold;">,</span> ppOutput            <span style="color: #339933; font-weight: bold;">=</span>   hPutStrLn h
    <span style="color: green;">&#125;</span></pre></div></div>

<p>In a last step, you launch each dzen2 instance</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Hooks<span style="color: #339933; font-weight: bold;">.</span>UrgencyHook
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Hooks<span style="color: #339933; font-weight: bold;">.</span>FadeInactive
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Util<span style="color: #339933; font-weight: bold;">.</span>Run
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Config<span style="color: #339933; font-weight: bold;">.</span>Gnome
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    workspaceBar &amp;lt; <span style="color: #339933; font-weight: bold;">-</span> spawnPipe myStatusBar
    conkyStats &amp;lt;<span style="color: #339933; font-weight: bold;">-</span> spawnPipe conkyStatsBar
    xmonad <span style="color: #339933; font-weight: bold;">$</span> withUrgencyHook NoUrgencyHook <span style="color: green;">&#123;</span>
        logHook             <span style="color: #339933; font-weight: bold;">=</span> myLogHook workspaceBar &amp;gt;&amp;gt; fadeInactiveLogHook 0xdddddddd
<span style="color: green;">&#125;</span></pre></div></div>

<p>Due to some encoding issue, again there is a space between &lt;- near workspaceBar which shouldn&#8217;t be there. The tiling algorithm however will overlap these status bars so you will have to tell XMonad not to do so.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Hooks<span style="color: #339933; font-weight: bold;">.</span>ManageDocks
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    xmonad <span style="color: green;">&#123;</span>
      manageHook          <span style="color: #339933; font-weight: bold;">=</span> manageDocks &amp;lt; <span style="color: #339933; font-weight: bold;">+</span>&amp;gt; myManageHook
<span style="color: green;">&#125;</span></pre></div></div>

<p>Recall that we have specified myManageHook earlier in this tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/howto-step-by-step-configuration-of-xmonad/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Howto: Add PulseAudio to GNOME 2.26 in Arch Linux</title>
		<link>http://www.nepherte.be/howto-add-pulseaudio-to-gnome-2-26-in-arch-linux/</link>
		<comments>http://www.nepherte.be/howto-add-pulseaudio-to-gnome-2-26-in-arch-linux/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 12:06:46 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2.26]]></category>
		<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[PulseAudio]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=788</guid>
		<description><![CDATA[As a follow up on my article about PulseAudio in Gnome 2.26, I&#8217;ll briefly explain how you can install PulseAudio integrated with Gnome in Arch Linux. As mentioned before, the Gnome maintainer in Arch Linux has patched Gnome to the way it was before version 2.26, at least the audio part. It is however very [...]]]></description>
			<content:encoded><![CDATA[<p>As a follow up on my article about PulseAudio in Gnome 2.26, I&#8217;ll briefly explain how you can install PulseAudio integrated with Gnome in Arch Linux. As mentioned before, the Gnome maintainer in Arch Linux has patched Gnome to the way it was before version 2.26, at least the audio part. It is however very easy to undo this with ABS. I suggest you read up on ABS if you&#8217;re not familiar with it.</p>
<h5>Install &amp; configure ABS</h5>
<p>First you will need to install the The Arch Build System (ABS) and the basic development tools:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pacman <span style="color: #660033;">-Sy</span> abs base-devel</pre></div></div>

<p>Make sure the core, extra and community repository are enabled in /etc/abs.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">REPOS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>core extra community <span style="color: #000000; font-weight: bold;">!</span>testing<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Now grab all the PKGBUILDS with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">abs</pre></div></div>

<h5>Install &amp; configure PulseAudio</h5>
<p>Install pulseaudio with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pacman <span style="color: #660033;">-S</span> pulseaudio</pre></div></div>

<p>There&#8217;s a lot to say about configuring pulseaudio, things I&#8217;m not going put here. More info on configuring pulseaudio can be found at <a href="http://wiki.archlinux.org/index.php/Pulseaudio">The Arch Wiki</a> and <a href="http://www.pulseaudio.org/wiki/PerfectSetup">The Official PulseAudio site</a>. The <em>must do</em> things are installing alsa-plugins to maintain alsa compatibility, configuring .asoundrc, adding yourself to the pulse-rt and pulse-access groups and configuring gstreamer to use pulse. I also <em>don&#8217;t</em> recommend using PulseAudio as a system-wide daemon. Just use the per-user daemon.</p>
<h5>Rebuild related Gnome packages</h5>
<p>There are a few gnome packages that need to be rebuilt against pulseaudio in this order:</p>
<ol>
<li>gnome-settings-daemon</li>
<li>gnome-applets</li>
<li>gnome-media</li>
</ol>
<p>Grab the build files from abs one at the time. They are all located under /var/abs/abs/&lt;packagename&gt;. You can build and install the package with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">makepkg <span style="color: #660033;">-si</span></pre></div></div>

<p><em>gnome-settings-daemon &#8211; </em>Remove the patch line (2nd line right after build) in the PKGBUILD.<br />
<em>gnome-applets &#8211; </em>Just needs a rebuild, no need to change anything.<br />
<em>gnome-media &#8211; </em>Add &#8211;enable-pulse to the ./configure line in the PKGBUILD.</p>
<p>That&#8217;s pretty much it. Next time you login using gnome, it will use pulseaudio. By default it adds a rather ugly volume slider to the panel (you can prevent it from starting by removing it under system &gt; preferences &gt; startup applications. You can add a better one by right clicking on the panel and adding the volume applet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/howto-add-pulseaudio-to-gnome-2-26-in-arch-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Comprehensive MPlayer Guide II: Installation</title>
		<link>http://www.nepherte.be/comprehensive-mplayer-guide-ii-installation/</link>
		<comments>http://www.nepherte.be/comprehensive-mplayer-guide-ii-installation/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 17:40:30 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Comprehensive Guide]]></category>
		<category><![CDATA[FFMPEG]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[MEncoder]]></category>
		<category><![CDATA[MPlayer]]></category>
		<category><![CDATA[x264]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=578</guid>
		<description><![CDATA[This article is the follow up of Comprehensive MPlayer Guide I: Introduction. To acquire a good MPlayer setup, you really don&#8217;t want to install the version packaged by your favorite distribution. The mainstream linux distributions like Ubuntu use &#8220;the latest&#8221; but very dated release of MPlayer. Their latest release,  v1.0rc2, dates from 7 October 2007. [...]]]></description>
			<content:encoded><![CDATA[<p>This article is the follow up of <a href="http://www.nepherte.be/comprehensive-mplayer-guide-i-introduction/">Comprehensive MPlayer Guide I: Introduction</a>.</p>
<p>To acquire a good MPlayer setup, you really don&#8217;t want to install the version packaged by your favorite distribution. The mainstream linux distributions like Ubuntu use &#8220;the latest&#8221; but very dated release of MPlayer. Their latest release,  v1.0rc2, dates from 7 October 2007. Go figure!  That doesn&#8217;t mean MPlayer isn&#8217;t actively being developed though. You see, the MPlayer developers believe in making continuous changes to their latest development version, generally referred to as the SVN version, rather than releasion official versions. This SVN version is 99% of the time stable, no need to worry there. Unfortunately, you will have to build it yourself. I will try to guide you through this rather lengthy process.</p>
<p>The build process consists of 3 main steps:</p>
<ul>
<li>Install x264</li>
<li>Install useful multimedia libraries and FFMPEG</li>
<li>Install MPlayer</li>
</ul>
<p><strong>Part I: x264</strong><br />
x264 is necessary for encoding videos in the  MPEG 4 AVC (H264/x264) codec. At the moment of writing this codec is one of the best and most popular codecs used (e.g. Blu-Ray) and undispensible if you intend to do some encoding. Before we continue, make sure you have the necessary build tools like make. They are usually bundled by your distribution in a general &#8220;build&#8221; package. Ubuntu, for example, has put everything in build-essential. Consult your distribution&#8217;s documentation to figure out what packages you need to build software.</p>
<p>x264 depends on the following packages:</p>
<ul>
<li><em>libx11</em></li>
<li> <em>gpac</em> (optional).</li>
</ul>
<p>The packages <em>git</em>, <em>yasm</em> and <em>gettext </em>are necessary for building x264. Technically you can remove the build dependencies after the x264 installation is completed but you will need them so often you might as well leave them installed. The installation of x264 goes as follows:</p>
<p>Get the sources:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>git.videolan.org<span style="color: #000000; font-weight: bold;">/</span>x264.git</pre></div></div>

<p>Configure x264:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> x264<span style="color: #000000; font-weight: bold;">/</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-visualize</span> <span style="color: #660033;">--enable-shared</span> <span style="color: #660033;">--enable-pic</span> <span style="color: #660033;">--enable-mp4-output</span></pre></div></div>

<p>You don&#8217;t need to worry much about these configuration options but I&#8217;ll briefly explain them. prefix= determines where the final build of x264 will reside. /usr is generally a good option. If prefix is not specified it will default to /usr/local/. enable-shared allows other programs to access this x264 build. This is something we really need. enable-mp4-output makes sure that we can save media files with the x264 codec to mp4 files. mp4-output requires you installed gpac. If you didn&#8217;t, remove this option from the ./configure line. enable-visualize speaks for itself. enable-pic builds position-independent code. You can get more info on the available configuration options with ./configure &#8211;help (that&#8217;s two &#8216;-&#8217; in case you are wondering).</p>
<p>Build and install x264:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>You can verify that x264 is correctly installed by typing  x264 &#8211;version (again, two &#8216;-&#8217;). You might have encountered a build error during the installation process. Therefore I advise you to always carefully read the output generated by ./configure and make. Errors are usually printed at the end of the output. There is no point in continuing with another step/command if you have an error. Errors often occur because you overlooked a required dependency.</p>
<p><strong>Part II: Install useful multimedia libraries and FFMPEG<br />
</strong>To get a working MPlayer setup you technically don&#8217;t have to perform this step because the svn server of MPlayer already holds the necessary ffmpeg and other libraries. The main disadvantage of using a built-in ffmpeg is that MPlayer and MPlayer only can make use of it. This means that if another program requires ffmpeg, you will have to install it again which leads to a lot of duplicate ffmpegs. An advantage of having a built-in ffmpeg over a separate one is that the mplayer devs often add some optimizations to their ffmpeg branch that are not availabe in the official branch. The mplayer devs recommend using their branch (stating the obvious I suppose), I&#8217;ll explain both methods. If you prefer a built-in ffmpeg, skip this section. Still here? Libraries that I recommend to install for a separate ffmpeg, are:</p>
<ul>
<li><em>subversion, imlib2</em>- build requirements for ffmpeg</li>
<li><em>xvidcore &#8211; </em>Support for xvid codec</li>
<li><em>faad2</em> and <em>faac -</em> for AAC decoding and encoding</li>
<li><em>smbclient &#8211; </em> for network files playback</li>
<li><em>lame</em> &#8211; for mp3 encoding</li>
<li><em>libtheora, libvorbis, speex</em> &#8211; support for the open source theora, vorbis and speech codec</li>
<li><em>zlib</em> &#8211; support for compression</li>
</ul>
<p>Some less commonly used optional features for ffmpeg:</p>
<ul>
<li><em>sdl</em><em> &#8211; </em>if you want ffmpeg to be able to play video files</li>
<li><em>gsm</em> &#8211; another lossy speech compression codec</li>
<li><em>dirac </em>or <em>libschroedinger</em> &#8211; video compression codec</li>
<li><em>amrnb, amrwb</em> &#8211; adaptive amr narrow and wide band speech codec</li>
</ul>
<p>Try to install them with the package management installer that comes with your distribution but I suggest you check the repository version of a library with the latest version.</p>
<p>Now let&#8217;s continue with FFMPEG. FFMPEG and MPlayer are practically twins, they go hand in hand with eachother. FFMPEG provides MPlayer with the most important tools to play multimedia: the common and not so common codecs for playback and encoding, (de)muxers for opening containers like mp4 and avi, filters and post processors.</p>
<p>Get the source:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>:<span style="color: #000000; font-weight: bold;">//</span>svn.ffmpeg.org<span style="color: #000000; font-weight: bold;">/</span>ffmpeg<span style="color: #000000; font-weight: bold;">/</span>trunk <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span></pre></div></div>

<p>Compile it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ffmpeg<span style="color: #000000; font-weight: bold;">/</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-gpl</span> <span style="color: #660033;">--enable-libmp3lame</span> <span style="color: #660033;">--enable-libvorbis</span> <span style="color: #660033;">--enable-libfaac</span> <span style="color: #660033;">--enable-xvid</span> <span style="color: #660033;">--enable-x264</span> <span style="color: #660033;">--enable-libtheora</span> <span style="color: #660033;">--enable-libspeex</span> <span style="color: #660033;">--enable-postproc</span> <span style="color: #660033;">--enable-avfilter</span> <span style="color: #660033;">--enable-avfilter-lavf</span> <span style="color: #660033;">--enable-shared</span> <span style="color: #660033;">--enable-network</span> <span style="color: #660033;">--enable-pthreads</span> <span style="color: #660033;">--enable-x11grab</span> <span style="color: #660033;">--arch</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -m<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>If you didn&#8217;t install all the packages from above, simply remove the corresponding configure option. If you  installed something out of the list of less commonly used libraries, add the corresponding option to the ./configure line. Remember to check ./configure &#8211;help for more information on the configuration options. After the ./configure [...] command, a nice layout with all the supported codecs and much more will be printed.</p>
<p>Build and install it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Et voilà. You should have a working ffmpeg. FFMPEG includes a player (if you installed sdl, that is) so you can verify that you installed it successfully by playing a media file. This is how you do it: ffplay &lt;path to video file&gt;. I will remind you here again that you may have encountered a build error during the installation process. Therefore I advise you to always carefully read the output generated by ./configure and make. Errors are usually printed at the end of the output. There is no point in continuing with another step/command if you have an error. Errors often occur because you overlooked a required dependency.</p>
<p><strong>Part III: Install MPlayer</strong><br />
Now we can finally move on to installing MPlayer. Some additional packages you could install:</p>
<ul>
<li><em>freetype, fribidi</em>, <em>aalib &#8211; </em> for unicode and ascii support (subtitles)</li>
<li><em>live555</em><em> &#8211; </em> support for streaming</li>
<li><em> libmpcdec</em><em> &#8211; </em> for musepack</li>
<li><em>twolame or toolame</em> &#8211; for optimized mpeg layer 2 encoding (twolame excludes toolame and vice versa)</li>
<li><em>openal, opengl, libxmvc</em>, <em>libxv, directfb, libpng, libjpeg &#8211; </em>for more video and audio outputs <em></em>.</li>
</ul>
<p>They&#8217;re all optional dependencies but they increase the capabilities of MPlayer a lot so there&#8217;s no reason not the install them.</p>
<p>Get the sources:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>:<span style="color: #000000; font-weight: bold;">//</span>svn.mplayerhq.hu<span style="color: #000000; font-weight: bold;">/</span>mplayer<span style="color: #000000; font-weight: bold;">/</span>trunk <span style="color: #c20cb9; font-weight: bold;">mplayer</span></pre></div></div>

<p>Patch MPlayer so it can disable the gnome-screensaver as well. There are patches for KDE as well, but I use GNOME:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.nepherte.be<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>mplayer-svn-gnome-screensaver.patch
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #c20cb9; font-weight: bold;">mplayer</span>
<span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span> ..<span style="color: #000000; font-weight: bold;">/</span>mplayer-svn-gnome-screensaver.patch</pre></div></div>

<p>The configure script of MPlayer incorporates a sort of auto-detection. It will check for a certain library/feature where it is normally located and afterwards it will set everything correct to use that feature. It is therefore recommended not to force or &#8211;enable an option in the ./configure line as it breaks the path detection of that feature.</p>
<p>Configure MPlayer with built-in (static) ffmpeg:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--confdir</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">mplayer</span> <span style="color: #660033;">--disable-gui</span> <span style="color: #660033;">--enable-menu</span> <span style="color: #660033;">--enable-runtime-cpudetection</span> <span style="color: #660033;">--enable-largefiles</span></pre></div></div>

<p>Configure MPlayer without built-in (shared) ffmpeg:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--confdir</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">mplayer</span> <span style="color: #660033;">--disable-gui</span> <span style="color: #660033;">--enable-menu</span> <span style="color: #660033;">--enable-runtime-cpudetection</span> <span style="color: #660033;">--enable-largefiles</span> --disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a --disable-libswscale_a</pre></div></div>

<p>I explicitely disabled the built-in gui because there are a lot better guis available. I&#8217;ll deal with this in Comprehensive MPlayer Guide III. The configure options that end with _a disable the built-in ffmpeg. The rest is pretty self-explanatory. You can save some space and compilation time by disabling unneeded features. Things I usually disable, are:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">--disable-inet6</span>  <span style="color: #660033;">--disable-tv</span>  <span style="color: #660033;">--disable-radio</span>  <span style="color: #660033;">--disable-ossaudio</span> <span style="color: #660033;">--disable-jack</span> <span style="color: #660033;">--disable-esd</span> <span style="color: #660033;">--disable-lirc</span> <span style="color: #660033;">--disable-dvb</span></pre></div></div>

<p>More information on the configure options can be found by executing ./configure &#8211;help.</p>
<p>Now build and install MPlayer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Again check the outputs of each command for errors. You can verify that mplayer is installed correctly with the command mplayer &lt;path to video file&gt;. As mentioned before, I&#8217;ll deal with the good guis for MPlayer in the next article.</p>
<p>If you come across an error during one of the installs and you can&#8217;t figure out how to fix them, drop a note and I&#8217;ll try to help out wherever possible.</p>
<p>The follow up, Comprehensive Guide III: Video Playback &amp; Desktop Integration, will soon be available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/comprehensive-mplayer-guide-ii-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comprehensive MPlayer Guide I: Introduction</title>
		<link>http://www.nepherte.be/comprehensive-mplayer-guide-i-introduction/</link>
		<comments>http://www.nepherte.be/comprehensive-mplayer-guide-i-introduction/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 19:12:11 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Comprehensive Guide]]></category>
		<category><![CDATA[MEncoder]]></category>
		<category><![CDATA[MPlayer]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=554</guid>
		<description><![CDATA[This article is meant as a comprehensive guide to acquire a complete multimedia experience, in particular everything that is video related: from installation and playback to encoding, desktop integration and much more . I will try to give an in-dept but understandable explanation of the how and perhaps more importantly, the why. I will not [...]]]></description>
			<content:encoded><![CDATA[<p>This article is meant as a comprehensive guide to acquire a complete multimedia experience, in particular everything that is video related: from installation and playback to encoding, desktop integration and much more . I will try to give an in-dept but understandable explanation of the how and perhaps more importantly, the why. I will not use a distro specific approach. The instructions apply to every linux distribution.</p>
<p>The guide includes 4 major sections:</p>
<ul>
<li>Introduction</li>
<li>Installation</li>
<li>Video Playback &amp; Desktop Integration</li>
<li>Video Encoding</li>
</ul>
<p>of which this is the first section: the introduction.</p>
<p>There are a lot of video players at hand. I&#8217;m going to use <a href="http://www.mplayerhq.hu/design7/news.html">MPlayer</a>, but why&#8217;s that?. MPlayer is by far the best multimedia player for linux. Not only does it handle video and audio content perfectly, it&#8217;s also capable of playing streams and integrates nicely in your browser.  It even supports video hardware acceleration for those with a recent video card. Yes, there are some alternatives like VLC, but none are as flexible as MPlayer.  You can easily determine which codecs should be enabled and which not. You&#8217;re not stuck with one gui. There are multiple guis available for several platforms. No matter what environment you are using, there&#8217;s a solution for every one of them.</p>
<p>Another thing that stands out is MEncoder. MEncoder is a part of MPlayer and is a tool to easily encode audio, video and extract subtitles. Everything you ever needed for encoding media is included in this application. Combining MPlayer and MEncoder make the perfect multimedia application.</p>
<p>The follow-up, <a href="http://www.nepherte.be/comprehensive-mplayer-guide-ii-installation/">Comprehensive MPlayer Guide II: Installation</a> is now available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/comprehensive-mplayer-guide-i-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mpd, ncmpc++ and keybindings for playback control</title>
		<link>http://www.nepherte.be/mpd-ncmpc-and-keybindings-for-playback-control/</link>
		<comments>http://www.nepherte.be/mpd-ncmpc-and-keybindings-for-playback-control/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 16:51:33 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=451</guid>
		<description><![CDATA[I already mentioned that mpd &#38; ncmpc++ is a great music player. I imagine a console music player can be a little discouraging and realized the other day that major desktop environments like Gnome don&#8217;t have built-in support for music playback control through mpd. If you assign a key to play/pause and next/previous song in the [...]]]></description>
			<content:encoded><![CDATA[<p>I already <a title="Howto: Use mpd and ncmpc++ like a pro" href="http://www.nepherte.be/howto-use-mpd-and-ncmpc-like-a-pro/">mentioned</a> that mpd &amp; ncmpc++ is a great music player. I imagine a console music player can be a little discouraging and realized the other day that major desktop environments like Gnome don&#8217;t have built-in support for music playback control through mpd. If you assign a key to play/pause and next/previous song in the Gnome control center,  it will work in a lot of popular music players like banshee, amarok, exaile and so on but not with mpd. When you finally convinced yourself to use mpd, this could be another setback.</p>
<p>The &#8220;problem&#8221; however can be easily solved. It&#8217;s as easy as</p>
<ul>
<li>figuring out the commands to play, pause and switch songs in mpd</li>
<li>assigning this command to a key</li>
</ul>
<p>For both steps exist several solutions of which I will explain one.</p>
<p><strong>Figuring out the commands<br />
</strong>You can&#8217;t control the playback of songs directly with mpd. You will have to do it with the frontend you are using. In my case that&#8217;s ncmpcpp but any other frontend such as mpc or ncmpc will do. Each action can be supplied as an argument for the ncmpcpp command:</p>
<ul>
<li>playback/pause: ncmpcpp toggle</li>
<li>previous song: ncmpcpp prev</li>
<li>next song: ncmpcppp next</li>
<li>stop: ncmpcpp stop</li>
</ul>
<p><strong>Assigning keys to the commands</strong><br />
I believe all desktop environments/window managers provide a way to assign keys to predefined and custom actions. The predefined actions in Gnome are easily accessible through the Gnome control center (Alt + F2 gnome-control-center). As mentioned earlier, the predefined actions for music playback don&#8217;t&#8217; work with mpd. We will have to create custom actions.</p>
<p>The custom actions in Gnome are well hidden in gconf-editor. Press Alt + F2 and type gconf-editor to open it. Navigate to /app/metacity/keybinding_commands and fill in the commands we found earlier. Afterwards you can assign a key to each command in /app/metacity/global_keybindings. Key modifiers like Ctrl and Alt are &lt;Control&gt; and &lt;Alt&gt; respectively.  I, for example, added ncmpcpp next to command_1 and assigned &lt;Control&gt;Left (Left is the left arow key) to run_command_1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/mpd-ncmpc-and-keybindings-for-playback-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Arch Linux on a Sony Vaio SZ 6</title>
		<link>http://www.nepherte.be/arch-linux-on-a-sony-vaio-sz-6/</link>
		<comments>http://www.nepherte.be/arch-linux-on-a-sony-vaio-sz-6/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 15:22:52 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Sony]]></category>
		<category><![CDATA[SZ]]></category>
		<category><![CDATA[Vaio]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=363</guid>
		<description><![CDATA[If you somewhat follow this blog, you probably know that I&#8217;m running Arch Linux as my primary operating system. I&#8217;m using this on my Sony Vaio SZ 6 for +/- 5 months now. I&#8217;m very pleased with both Arch Linux and the laptop and they happily work together. This article is about how I set [...]]]></description>
			<content:encoded><![CDATA[<p>If you somewhat follow this blog, you probably know that I&#8217;m running <a href="http://www.archlinux.org">Arch Linux</a> as my primary operating system. I&#8217;m using this on my Sony Vaio SZ 6 for +/- 5 months now. I&#8217;m very pleased with both Arch Linux and the laptop and they happily work together. This article is about how I set up Arch on this Sony Vaio. There were made several models in the SZ series and the instructions should more or less apply to most of them. If you are an owner of this laptop and you tryed out these instructions, I&#8217;d be happy to get your feedback on it.</p>
<h5>Change Log</h5>
<p>21-02-2010:</p>
<ul>
<li>Added nouveau driver as alternative to official nvidia driver</li>
<li>Mention the use of KMS</li>
</ul>
<p>27-06-2009:</p>
<ul>
<li>Added ftp install disk to installation notes</li>
<li>Mention the use of module auto-detection</li>
<li>Arch now uses /etc/modprobe.d/modprobe.conf</li>
<li>Had a change to test the mic, it works</li>
<li>No need to add dbus if hal is specified</li>
<li>Brightness works as is now</li>
<li>Added FN-keys section</li>
</ul>
<p></p>
<h5>Table of Content:</h5>
<p><a href="#hardware">1. Hardware Specifications</a><a href="http://www.nepherte.be/wp-content/uploads/2009/03/sony-vaio-sz6.jpg"><img class="alignright size-medium wp-image-424" title="Sony Vaio SZ6" src="http://www.nepherte.be/wp-content/uploads/2009/03/sony-vaio-sz6-300x224.jpg" alt="Sony Vaio SZ6" width="300" height="224" /></a><br />
<a href="#installation">2. Installation</a><br />
<a href="#arch">3. Arch Linux</a><br />
<a href="#processor">4. Processor</a><br />
<a href="#wired">5. Wired Network</a><br />
<a href="#wireless">6. Wireless Network</a><br />
<a href="#sound">7. Sound Card</a><br />
<a href="#graphics">8. Graphic Cards</a><br />
<a href="#keyboard">9. Keyboard</a><br />
<a href="#touchpad">10. Touchpad</a><br />
<a href="#bluetooth">11. Bluetooth</a><br />
<a href="#webcam">12. Webcam</a><br />
<a href="#brightness">13. Brightness</a><br />
<a href="#modem">14. Modem</a><br />
<a href="#cardreader">15. Card Reader</a><br />
<a href="#suspend">16. Suspend &amp; Hibernate</a><br />
<a href="#fnkeys">17. FN Keys</a></p>
<h5>Appendix:</h5>
<p><a href="#cpuinfo">A. CPU Info</a><br />
<a href="#intel">B. Intel X Configuration File</a><br />
<a href="#nvidia">C. Nvidia X Configuration File</a><br />
<a href="#evdev">D. Keyboard Configuration File</a><br />
<a href="#synaptics">E. Touchpad Configuration File</a><br />
<a href="#lspci">F. Lspci Output</a><br />
<a href="#lsusb">G. Lsusb Output</a></p>
<h5><a name="hardware">Hardware Specifications</a></h5>
<p>Here are the relevant hardware specifications for the Sony Vaio SZ61 XN/C:</p>
<ul>
<li>Processor:	            Intel Core 2 Duo T7500 @ 2.2GHz</li>
<li>Memory:		    2048MB @ 533Mhz DDR2</li>
<li>Hard Disk:	            160GB 5400rpm</li>
<li>Graphics:	            nVidia GeForce 8400M GS + Intel GM965 Integrated Graphics</li>
<li>Sound Card:            Sigmatel CXD9872 Intel High Definition Audio Codec</li>
<li>Wireless Network:    Intel PRO/Wireless 3945ABG</li>
<li>Wired Network:        Marvel 88E8055 PCI-E Gigabit Ethernet</li>
<li>Bluetooth:	            Cambridge Silicon Radio</li>
<li>Webcam:                 Ricoh r5u870 (05ca:183a)</li>
<li>Touchpad:               AlpsPS/2 ALPS Touchpad</li>
</ul>
<p></p>
<h5><a name="installation">Installation</a></h5>
<p>The installation is pretty straight forward following the <a href="http://wiki.archlinux.org/index.php/Beginners_Guide">Arch Linux Beginner&#8217;s Guide</a>. You shouldn&#8217;t encounter any problems if you read the guide&#8217;s instructions carefully. I recommend using the Intel GM965 graphic card during the installation and a wired network if it&#8217;s at your disposal. You can then configure the other graphic card and the wireless network afterwards. Nevertheless, the installation should work with whatever you chose to use but it might require some extra steps. From now on I will be assuming you followed my recommendation. For the record, I&#8217;ve used  both the 2008.06 x86_64 core and ftp install disk with success. In the end they aren&#8217;t any different from eachother. When using the ftp install disk, you&#8217;ll end up with the most recent packages available in the repositories at once. When using the core cd, you need to issue a system wide update to acquire the same result.</p>
<h5><a name="arch">Arch Linux</a></h5>
<p>This tutorial is written while using a snapshot of Arch Linux, dated on 28 february 2009. This snapshot includes the following versions of important packages:</p>
<ul>
<li>Arch Linux 64 bit fully updated</li>
<li>Kernel 2.6.28.7 SMP PREEMPT</li>
<li>X.org 7.4 (xorg-server 1.5.3-4)</li>
<li>Alsa 1.0.19</li>
<li>Nvidia driver 180.22</li>
<li>XF86-video-intel 2.4.3-1</li>
</ul>
<p>As you may have noticed, I&#8217;m using a 64 bit operating system. Some people are afraid of it, thinking it is somehow more difficult or that it is missing some important software packages. Others are just opposed to 64 bit. I can tell you there is no reason not to use 64 bit. There is no important software missing (there is a native 64 bit version for both java, its browser plugin and flash) and in few specific scenarios you&#8217;ll get a significant performance increase.</p>
<h5><a name="processor">Processor</a></h5>
<p>The dual core processor is, obviously, recognized out of the box. By installing cpufrequtils, you can enable cpu frequency scaling:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> cpufrequtils</pre></div></div>

<p>To start the cpu frequency scaling daemon on startup, add cpufreq to the DAEMON array in /etc/rc.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DAEMONS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>syslog-ng <span style="color: #000000; font-weight: bold;">@</span>cpufreq ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>The available scaling governor is cpufreq_ondemand. You will have to load this module together with acpi-cpufreq on startup by adding it to the MODULES array in /etc/rc.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MODULES</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>acpi-cpufreq cpufreq_ondemand ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>You can set the desired governer (ondemand) in /etc/conf.d/cpufreq along with the minimum and maximum cpu frequency:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">governor</span>=<span style="color: #ff0000;">&quot;ondemand&quot;</span>
<span style="color: #007800;">min_freq</span>=<span style="color: #ff0000;">&quot;0.8GHz&quot;</span>
<span style="color: #007800;">max_freq</span>=<span style="color: #ff0000;">&quot;2.2GHz&quot;</span></pre></div></div>

<p>The full output of /proc/cpuinfo can be found in <a href="#cpuinfo">Appendix A</a>. More information about cpu frequency scaling can be found on the Arch Linux <a href="http://wiki.archlinux.org/index.php/CPU_Frequency_Scaling">CPU Frequency Scaling</a> and <a href="http://wiki.archlinux.org/index.php/Cpufrequtils">Cpufrequtils</a> page.</p>
<h5><a name="wired">Wired Network</a></h5>
<p>The Marvel 88E8055 PCI-E Gigabit Ethernet network card should have been detected during the installation, together with the appropriate module. It uses the sky2 module. Add it to the MODULES array:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MODULES</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>sky2<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p><em>For a while now, Arch Linux is able to auto-detect the required modules by setting</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MOD_AUTOLOAD</span>=<span style="color: #ff0000;">&quot;yes&quot;</span></pre></div></div>

<p>in /etc/rc.conf. There is no need to specify all the modules in the MODULES array anymore. Only to explicity prohibit something from loading, the MODULES array is useful. In a limited number of cases, it doesn&#8217;t detect the modules like the ones from cpu scaling. I simply list the modules for reference.</em></p>
<h5><a name="wireless">Wireless Network</a></h5>
<p>First, you will need the wireless_tools package. If you have a wired network connection available, it&#8217;s as easy as:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> wireless_tools</pre></div></div>

<p>The package is also included in the Arch Linux install disc. If you want to use the wireless network during the setup, don&#8217;t forget to install it.</p>
<p>Apart from wireless_tools, you will also need the firmware for the wireless network card, in our case the Intel 3945/ABG. Install iwlwifi-3945-ucode:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> iwlwifi-<span style="color: #000000;">3945</span>-ucode</pre></div></div>

<p>Now add the iwl3945 module to the modules array. I also recommend blacklisting the older propriatary module ipw3945 to avoid any conflicts:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MODULES</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>ipw3945 iwl3945 ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>For more information on setting up a wireless network card, especially during the installation, see the <a href="http://wiki.archlinux.org/index.php/Wireless">Arch Linux Wireless</a> page.</p>
<h5><a name="sound">Sound Card</a></h5>
<p>The sound card should be detected during the installation, together with the necessary modules. In case something goes wrong, here are the modules you have to load:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MODULES</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>snd_pcsp snd-mixer-oss snd-pcm-oss snd-hwdep snd-page-alloc snd-pcm snd-timer snd snd-hda-intel soundcore ..<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>I also disabled the pc speaker (!snd_pcsp and !pcspkr) because it really irritates me and probably you as well. The headphone jack doesn&#8217;t work without an extra line in /etc/modprobe.d/modprobe.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">options snd-hda-intel <span style="color: #007800;">model</span>=vaio</pre></div></div>

<p>Recording sound using the microphone input works out of the box.</p>
<h5><a name="graphics">Graphic Cards</a></h5>
<p>As mentioned before, this laptop comes with 2 graphic cards: one on board Intel card and one dedicated Nvidia card. You can get each single one to work without ever using the other. You can also set up Arch Linux to use both, but only one will be active at the time of course. You should already have one card working with the Arch Linux installation. I&#8217;ll explain how to get both working. Apart from installing xorg and mesa, you need a libgl implementation. Open source drivers use the libgl package from the repositories, propriatary drivers come with their own libgl implemenation. Now here&#8217;s the bad news: when installing both drivers from the repositories, these two libgl implementations will conflict and pacman will refuse to install both. We&#8217;ll install the Intel driver first if you haven&#8217;t already done that during the installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> xorg mesa libgl xf86-video-intel</pre></div></div>

<p>That shouldn&#8217;t give you any problems since the Nvidia driver is not installed yet. My xorg.conf file for the Intel card can be found in <a href="#intel">Appendix B</a>. </p>
<p>The Intel card and its driver fully support kernel mode setting (KMS) and with a more recent kernel and Intel driver, KMS is required. The most noteworthy features of KMS are full resolution virtual terminals and fast switching between virtual terminals. For more information about KMS, see the <a href="http://wiki.archlinux.org/index.php/KMS">Arch Linux KMS page</a>.</p>
<p>Now we move on to the Nvidia card. Reboot your laptop and use the speed mode switch on the laptop. The X server will refuse to start. No problem, login using the console after you cancelled the X server messages. Instead of installing the Nvidia drivers with pacman, we&#8217;re going to install it manually to avoid pacman conflicts. It won&#8217;t harm the system. Open up a terminal, make sure you&#8217;re in the home directory and get the driver from the Nvidia website:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>us.download.nvidia.com<span style="color: #000000; font-weight: bold;">/</span>XFree86<span style="color: #000000; font-weight: bold;">/</span>Linux-x86_64<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">180.22</span><span style="color: #000000; font-weight: bold;">/</span>NVIDIA-Linux-x86_64-<span style="color: #000000;">180.22</span>-pkg2.run</pre></div></div>

<p>You can always change the version number if you want an older or more recent driver.</p>
<p>Switch to run level 3 to make sure X isn&#8217;t running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> telinit <span style="color: #000000;">3</span></pre></div></div>

<p>Go back to where we downloaded the driver (home directory) and launch the installer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> NVIDIA-Linux-x86_64-<span style="color: #000000;">180.22</span>-pkg2.run</pre></div></div>

<p>From now on, simply follow the installer&#8217;s instructions. Afterwards you&#8217;ll have the Nvidia driver installed. You can find my /etc/X11/xorg.conf file for the Nvidia card in <a href="#nvidia">Appendix C</a>. You can already start X to see if it&#8217;s also working with your Nvidia card:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">startx</pre></div></div>

<p>Now it&#8217;s simply a matter of using the right xorg.conf configuration file for each graphic card. To automatically use the correct one on boot, you can use this script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">VIDEO</span>=<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">lspci</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-c</span> nVidia<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VIDEO</span>&quot;</span> = <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>X11<span style="color: #000000; font-weight: bold;">/</span>xorg.conf.nvidia <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>X11<span style="color: #000000; font-weight: bold;">/</span>xorg.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nvidia Card Detected&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>X11<span style="color: #000000; font-weight: bold;">/</span>xorg.conf.intel <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>X11<span style="color: #000000; font-weight: bold;">/</span>xorg.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Intel Card Detected&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Make sure you have /etc/X11/xorg.conf.nvidia and /etc/X11/xorg.conf.intel or change the paths in the script to the correct ones. Save the script somewhere and make it executable. Now add the path of the script to /etc/rc.local:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>xorg<span style="color: #000000; font-weight: bold;">/</span>switch<span style="color: #000000; font-weight: bold;">/</span>script</pre></div></div>

<p>One downside of this method is that you can only use the 3D mode with one graphic card, in this case the nvidia card. I figured you&#8217;d want the better card of the two to be able to use the 3D mode. Another downside is that you won&#8217;t be able to change the brightness of your screen (maybe you can but I didn&#8217;t look into it). Changing the brightness does work when you only use the Intel card. You&#8217;ll have to decide for yourself if the advantages outweigh the disadvantages.</p>
<p>An interesting alternative to the official binary NVIDIA driver is the open-source nouveau driver. It has excellent 2D support and supports KMS. If you don&#8217;t need 3D support (which is still in development), I even recommend nouveau over the official driver. To install the nouveau driver:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> xf86-video-nouveau nouveau-firmware</pre></div></div>

<p></p>
<h5><a name="keyboard">Keyboard</a></h5>
<p>Since X.org 7.4, hal takes care of your keyboard/mouse/touchpad, also known as hot-plugging. Therefore you don&#8217;t have to put a keyboard input device section in your xorg.conf file as you can see in the one I provided (see <a href="#intel">Appendix B</a> or <a href="#nvidia">Appendix C</a>). Make sure you have the xf86-input-evdev package installed and that you have the hal service running. Then you can use my file found in <a href="#evdev">Appendix D</a>. Save it to /etc/hal/fdi/policy/10-keymap.fdi and restart the hal service.</p>
<p>More information on hot-pluggable input devices can be found on the <a href="http://wiki.archlinux.org/index.php/Xorg_input_hotplugging">Arch Linux Xorg Input Hotplugging</a> page.</p>
<h5><a name="touchpad">Touchpad</a></h5>
<p>The touchpad is similar to the keyboard: you will need a fdi file to get it to work. Tapping, right mouse click in the corner, horizontal and vertical scrolling, &#8230; it all works. My fdi file can be found in <a href="#synaptics">Appendix E</a>. Save it to /etc/hal/fdi/policy/11&#8211;x11-synaptic.fdi and restart the hal service.</p>
<h5><a name="bluetooth">Bluetooth</a></h5>
<p>You need the linux bluetooth protocol stack. To install, run</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> bluez</pre></div></div>

<p>You need to start dbus and bluetooth in that order. You could add it to the DAEMONS array:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DAEMONS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span>dbus bluetooth ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>but I only start the bluetooth service when needed. That way I save some battery time. Note that hal already starts the dbus daemon by itself so if you have hal listed in the DAEMONS array, you don&#8217;t need to add dbus anymore. Gnome also has a nice applet you can load for bluetooth. I also strongly recommend blueman, a GTK+ bluetooth management utility. For more information, again see the <a href="http://wiki.archlinux.org/index.php/Bluetooth">Arch Linux Bluetooth</a> page.</p>
<h5><a name="webcam">Webcam</a></h5>
<p>Some time ago, the developper of the drivers for this webcam switched to a userspace tool instead of using kernel modules. This is how you get webcam working:</p>
<p>Get mercurial:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pacman <span style="color: #660033;">-S</span> mercurial</pre></div></div>

<p>Set up a directory where we will build the driver:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>r5u870</pre></div></div>

<p>Get the source:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>r5u870
hg clone http:<span style="color: #000000; font-weight: bold;">//</span>bitbucket.org<span style="color: #000000; font-weight: bold;">/</span>ahixon<span style="color: #000000; font-weight: bold;">/</span>r5u87x<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Build the driver:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> r5u87x
<span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>Load the driver with the correct firmware:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ucode<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ..<span style="color: #000000; font-weight: bold;">/</span>loader <span style="color: #660033;">-f</span> r5u87x-05ca-183a.fw</pre></div></div>

<p>You will probably have to reload the uvcvideo module to get your webcam working in the current session:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> rmmod uvcvideo <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> modprobe uvcvideo</pre></div></div>

<p>Every time you want to use the webcam, you have to use loader. A more convenient way is to create an alias for this rather long command. To do so, add the following to your .bashrc file (located in your home directory):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">webcam</span>=<span style="color: #ff0000;">'sudo /home/user/r5u870/r5u87x/loader --reload -f /home/user/r5u870/r5u87x/ucode/r5u87x-05ca-183a.fw'</span></pre></div></div>

<p>Don&#8217;t forget to replace user with your user name. There are sevaral programs you can use for your webcam. The most popular ones are cheese (gnome), xawtv and skype.</p>
<h5><a name="brightness">Brightness</a></h5>
<p>For a while now, brightness works without any hacks for the intel card. I&#8217;ll leave the hack here to get it to work in older arch linux installations: It relies on xbacklight and acpid to change the brightness of the screen. xbacklight is included in the xorg-server-util package. The latter one is probably already installed, but xbacklight might not. Be sure to add acpid to the DAEMONS array:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DAEMONS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">@</span>acpid ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Now create a brightness script named sonybright.sh in /etc/acpi/actions containing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;x$1&quot;</span> = <span style="color: #ff0000;">&quot;xdown&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
xbacklight <span style="color: #660033;">-time</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-steps</span> <span style="color: #000000;">10</span> <span style="color: #660033;">-dec</span> <span style="color: #000000;">10</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>sonybright.log
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;x$1&quot;</span> = <span style="color: #ff0000;">&quot;xup&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
xbacklight <span style="color: #660033;">-time</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-steps</span> <span style="color: #000000;">10</span> <span style="color: #660033;">-inc</span> <span style="color: #000000;">10</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>sonybright.log
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">2</span> Unknown argument $<span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>This script is supposed to be executed whenever you press the brightness up and down key. To do so, you will need to create two more files in /etc/acpi/events: sonybright-up and sonybright-down</p>
<p>sonybright-up:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/acpi/events/sony-brightness-up</span>
<span style="color: #007800;">event</span>=sony<span style="color: #000000; font-weight: bold;">/</span>hotkey SPIC 00000001 00000011
<span style="color: #007800;">action</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>acpi<span style="color: #000000; font-weight: bold;">/</span>actions<span style="color: #000000; font-weight: bold;">/</span>sonybright.sh up</pre></div></div>

<p>sonybright-down:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/acpi/events/sony-brightness-down</span>
<span style="color: #007800;">event</span>=sony<span style="color: #000000; font-weight: bold;">/</span>hotkey SPIC 00000001 00000010
<span style="color: #007800;">action</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>acpi<span style="color: #000000; font-weight: bold;">/</span>actions<span style="color: #000000; font-weight: bold;">/</span>sonybright.sh down</pre></div></div>

<p>the event SPIC key should be the same, however it is best to verify this with the acpi_listen command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">acpi_listen</pre></div></div>

<h5><a name="modem">Modem</a></h5>
<p>Not tested.</p>
<h5><a name="cardreader">Card Reader</a></h5>
<p>Works out of the box. Nothing extra is required.</p>
<h5><a name="suspend">Suspend &amp; Hibernate</a></h5>
<p>Suspending and hibernating the laptop works hassle free. It only works with the Intel card out of the box though. I take you could also make it work for the Nvidia card by editing some files, but then I assume it wouldn&#8217;t work for the Intel card. Since you probably want to use suspension and hibernation for saving power, you&#8217;d want to Intel card as it consumes less power to start with.</p>
<h5><a name="fnkeys">FN Keys</a></h5>
<p>The most important fn keys are working: volume up/down, mute, brightness up/down, switch monitor. The fn-keys rely on acpi. Make sure acpi and acpid are installed and add acpid to the DAEMONS array:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DAEMONS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">@</span>acpid ... <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>You should be able to get other fn keys to work in a way similar to the old brightness hack as listed in the <a href="#brightness">Brightness</a> section.</p>
<h5><a name="cpuinfo">A. CPU Info</a></h5>
<p><a href="http://www.nepherte.be/files/cpuinfo">Here</a>&#8216;s the full output of /proc/cpuinfo. You can also verify that cpu frequency scaling is enabled and working (cpu MHz	 800.000).</p>
<h5><a name="intel">B. Intel X Configuration File</a></h5>
<p><a href="http://www.nepherte.be/files/xorg.conf.intel">Here</a>&#8216;s my Intel X Configuration File.</p>
<h5><a name="nvidia">C. Nvidia X Configuration File</a></h5>
<p><a href="http://www.nepherte.be/files/xorg.conf.nvidia">Here</a>&#8216;s my Nvidia X Configuration File.</p>
<h5><a name="evdev">D. Keyboard Configuration File</a></h5>
<p><a href="http://www.nepherte.be/files/10-keymap.fdi">Here</a>&#8216;s my Keyboard Configuration File. Don&#8217;t forget the change the keyboard layout to correspond with your language.</p>
<h5><a name="synaptics">E. Touchpad Configuration File</a></h5>
<p><a href="http://www.nepherte.be/files/11-x11-synaptics.fdi">Here</a>&#8216;s my Touchpad Configuration File.</p>
<h5><a name="lspci">F. Lspci Output</a></h5>
<p><a href="http://www.nepherte.be/files/lspci">Here</a>&#8216;s the output for lspci. The nvidia card isn&#8217;t listed because I&#8217;m using the Intel card right now.</p>
<h5><a name="lsusb">G. Lsusb Output</a></h5>
<p><a href="http://www.nepherte.be/files/lsusb">Here</a>&#8216;s the output for lsusb.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/arch-linux-on-a-sony-vaio-sz-6/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Howto: mpd and your iphone</title>
		<link>http://www.nepherte.be/howto-mpd-and-your-iphone/</link>
		<comments>http://www.nepherte.be/howto-mpd-and-your-iphone/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 13:09:08 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mpd]]></category>
		<category><![CDATA[music player]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=216</guid>
		<description><![CDATA[In a previous article, I&#8217;ve been telling you about the powerful Music Player Daemon (mpd) and its wide range of possibilities. I briefly mentioned the use of your iphone or ipod touch as a remote control for your media station with mpd running. Today I&#8217;ve put it to the test and was amazed with how [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.nepherte.be/howto-use-mpd-and-ncmpc-like-a-pro/" title="Howto: Use mpd and ncmpc++ like a pro">previous article</a>, I&#8217;ve been telling you about the powerful <a href="http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki">Music Player Daemon</a> (mpd) and its wide range of possibilities. I briefly mentioned the use of your iphone or ipod touch as a remote control for your media station with mpd running. Today I&#8217;ve put it to the test and was amazed with how easy it was to set up.</p>
<p>I already explained setting up and running mpd. Only a few changes are worth mentioning. First of all you will have to change the bind address. By default it&#8217;s set to 127.0.0.1 so only the local host can connect to it. Since we will be connecting to mpd remotely with the iphone we have to change this value (the iphone will recognize 127.0.0.1 as itself). Open up ~/.mpdconf and make this change:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">bind_to_address = any</pre></div></div>

<p>I also suggest you enable password authentication in mpd as anyone with access to your network will be able to connect:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">password <span style="color: #ff0000;">&quot;yourpasswordhere@read,add,control,admin&quot;</span></pre></div></div>

<p>Remember that if you have a firewall blocking incoming connections (iptables doesn&#8217;t do this by default), you will have to allow tcp connections on port 6600. That&#8217;s it for the server side.</p>
<p>For the iphone, it&#8217;s even easier. There are a few mpd clients that exist for the iphone: <a href="http://code.google.com/p/impdclient/" title="impdclient">impdclient</a> and <a href="http://www.katoemba.net/makesnosenseatall/mpod/" title="MPoD">mpod</a>. I tried the latter. It&#8217;s available in the app store (firmware 2.x required). Simply install it and an icon will appear in the home screen. Launch mpod and fill in the settings in its configuration menu. Pay extra attention to the ip address. When the server running mpd is using dhcp, the ip address might change. Therefore I recommend you use static ip addresses.</p>
<p>That&#8217;s pretty much it. You can now control your music remotely from your iphone. An ideal music center setup.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/howto-mpd-and-your-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: Enable DVD menus in MPlayer</title>
		<link>http://www.nepherte.be/howto-enable-dvd-menus-in-mplayer/</link>
		<comments>http://www.nepherte.be/howto-enable-dvd-menus-in-mplayer/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 20:47:50 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[dvd menu]]></category>
		<category><![CDATA[MPlayer]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=198</guid>
		<description><![CDATA[A lot of distributions ship a binary of mplayer that is one, old, and two, doesn&#8217;t have the capability to see the menu of a dvd. The reason they ship an old binary of mplayer is because the developpers of mplayer don&#8217;t believe in releases. The &#8220;latest&#8221; release dates of October 2007. Yup that&#8217;s more [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of distributions ship a binary of mplayer that is one, old, and two, doesn&#8217;t have the capability to see the menu of a dvd. The reason they ship an old binary of mplayer is because the developpers of mplayer don&#8217;t believe in releases. The &#8220;latest&#8221; release dates of October 2007. Yup that&#8217;s more than a year ago. What the developpers do believe in, is svn. Every change they make is just put in svn and that&#8217;s where you&#8217;ll get a recent version of mplayer.</p>
<p>First we need a recent version of dvdread and dvdnav, two libraries that allow us to view and navigate through dvd menus. We start with dvdread. Again, you will probably have a very old version of dvdread, so we get a recent version. Dvdread depends on libdvdcss so make sure you have it. You will also need the tools to compile from source of course.</p>
<p>1. Get the source:<br />
<code>wget http://www7.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdread-4.1.3.tar.bz2</code><br />
2. Unpack it and navigate to the directory:<br />
<code>tar xvfj libdvdread-4.1.3.tar.bz2<br />
cd libdvdread-4.1.3</code><br />
3. Compile, build and install:<br />
<code>./autogen.sh --prefix=/usr<br />
make<br />
sudo make install</code></p>
<p>Now we do the same for dvdnav:</p>
<p>1. Get the source:<br />
<code>wget http://www8.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdnav-4.1.3.tar.bz2</code><br />
2. Unpack it and navigate to the directory:<br />
<code>tar xvfj libdvdnav-4.1.3.tar.bz2<br />
cd libdvdnav-4.1.3.tar.bz2</code><br />
3. Compile, build and install:<br />
<code>./autogen.sh --prefix=/usr<br />
make<br />
sudo make install</code></p>
<p>Now that we have everything to read a dvd and its dvd menu, it&#8217;s time to install mplayer with this functionality.</p>
<p>1. Get the source:<br />
<code>svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer</code><br />
2. Navigate to the directory:<br />
<code>cd mplayer</code><br />
3. Compile, build and install. There are a lot of configuration options available for mplayer, but I will only mention the ones you need to enable dvd menus.</p>
<p><code>./configure --disable-dvdread-internal --enable-dvdnav<br />
make<br />
sudo make install</code></p>
<p>Now hurry up and try out some fancy dvd menu with mplayer. Here are a few of The Terminal:<a href="http://www.nepherte.be/wp-content/uploads/2008/12/dvdmenu.png"><br />
</a></p>
<p><a href="http://www.nepherte.be/wp-content/uploads/2008/12/languagemenu.png"><img class="size-medium wp-image-211 alignleft" title="The Terminal Language Menu" src="http://www.nepherte.be/wp-content/uploads/2008/12/languagemenu-300x187.png" alt="The Terminal Language Menu" width="300" height="187" /></a></p>
<p><a href="http://www.nepherte.be/wp-content/uploads/2008/12/dvdmenu.png"><img class="alignnone size-medium wp-image-210" title="The Terminal DVD Menu" src="http://www.nepherte.be/wp-content/uploads/2008/12/dvdmenu-300x187.png" alt="The Terminal DVD Menu" width="300" height="187" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nepherte.be/howto-enable-dvd-menus-in-mplayer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: Use mpd and ncmpc++ like a pro</title>
		<link>http://www.nepherte.be/howto-use-mpd-and-ncmpc-like-a-pro/</link>
		<comments>http://www.nepherte.be/howto-use-mpd-and-ncmpc-like-a-pro/#comments</comments>
		<pubDate>Thu, 25 Dec 2008 18:39:58 +0000</pubDate>
		<dc:creator>Nepherte</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[mpd]]></category>
		<category><![CDATA[music player]]></category>
		<category><![CDATA[ncmpcpp]]></category>

		<guid isPermaLink="false">http://www.nepherte.be/?p=182</guid>
		<description><![CDATA[I tend to use the command line more often these days. When I have to do some task, I find it easier and faster to open a terminal and enter the necessary commands than using the GUI. The same thing goes for applications. When you know how to use a specific console program, it can [...]]]></description>
			<content:encoded><![CDATA[<br />
<b>Fatal error</b>:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 68376 bytes) in <b>/home/user/nepherte/www/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3607</b><br />
