<?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>Think In Geek &#187; linux</title>
	<atom:link href="http://thinkingeek.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://thinkingeek.com</link>
	<description>In geek we trust</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:45:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Simple guide to configure xmonad, dzen2 and conky</title>
		<link>http://thinkingeek.com/2011/11/21/simple-guide-configure-xmonad-dzen2-conky/</link>
		<comments>http://thinkingeek.com/2011/11/21/simple-guide-configure-xmonad-dzen2-conky/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 13:39:44 +0000</pubDate>
		<dc:creator>brafales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[xmonad]]></category>

		<guid isPermaLink="false">http://thinkingeek.com/?p=192</guid>
		<description><![CDATA[I&#8217;ll guide you through the different steps I took to install a working desktop environment in Debian using xmonad, conky and dzen2. The final result of this configuration should look like this: Installing the prerequisites The first thing you should do is install the Haskell compiler and interpreter (I&#8217;m assuming you&#8217;re using Debian Sid). To [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ll guide you through the different steps I took to install a working desktop environment in Debian using xmonad, conky and dzen2.
</p>
<p>
The final result of this configuration should look like this:<br />
<div id="attachment_194" class="wp-caption alignnone" style="width: 310px"><a href="http://thinkingeek.com/wp-content/uploads/2011/11/2011-11-21-141251_3120x1050_scrot.png"  rel="lightbox[roadtrip]"><img src="http://thinkingeek.com/wp-content/uploads/2011/11/2011-11-21-141251_3120x1050_scrot-300x100.png" alt="xmonad with dzen2 and conky" title="xmonad with dzen2 and conky" width="300" height="100" class="size-medium wp-image-194" /></a><p class="wp-caption-text">xmonad with dzen2 and conky</p></div>
</p>
<p><span id="more-192"></span></p>
<h2>Installing the prerequisites</h2>
<p>
The first thing you should do is install the Haskell compiler and interpreter (I&#8217;m assuming you&#8217;re using Debian Sid). To do that, use your beloved aptitude package manager:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ghc6</pre></div></div>

</p>
<p>
To install Xmonad I recommend using the Haskell package manager cabal:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> cabal</pre></div></div>

</p>
<p>
After cabal is installed, you&#8217;ll have to update the package list by running <em>cabal update</em>. However, when doing this, cabal might tell you that there is newer version of the package manager to be installed. Follow the on screen instructions and upgrade to the latest cabal:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cabal <span style="color: #c20cb9; font-weight: bold;">install</span> cabal-install</pre></div></div>

</p>
<p>
This will install the latest cabal into your home directory. From now on, make sure that <em>/home/&lt;your_username&gt;/.cabal/bin</em> is on the path to be using this newly installed cabal build. Run <em>cabal update</em> again to have the package list updated.
</p>
<h2>Installing Xmonad</h2>
<p>
Installing xmonad is as easy as running <em>cabal install xmonad</em>. This will try to download, compile and install xmonad and all the prerequisites. However, you may have some compile errors. This is because to compile Xmonad you need to have some development libraries installed. Typically you&#8217;ll need <em>libx11-dev</em>, <em>libxinerama-dev</em> and <em>libxext-dev</em>, among others. To install those dependencies just look for them in the apt respositories and install them using aptitude or apt-get:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libx11-dev libxinerama-dev libxext-dev</pre></div></div>

</p>
<p>
After installing xmonad, is recommended you also install <em>xmonad-contrib</em>, which includes some extra functionalities to Xmonad tant we will find useful later. Note that to install xmonad-contrib you&#8217;ll need to install the <em>xft</em> development libraries, too:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libxft-dev
cabal <span style="color: #c20cb9; font-weight: bold;">install</span> xmonad-contrib</pre></div></div>

</p>
<p>
Ok, with this steps you already have a fully functional xmonad version installed and ready to be run. We will need to add some eye candy to it now, however, to make it more usable. If you want to have it a try now, though, to see if everything works as expected, just edit your <em>~/.xsession</em> file to make it look like this:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">exec</span> xmonad</pre></div></div>

</p>
<p>
And now just start your X with <em>startx</em> (or make your display manager to use the default session). You should see&#8230; nothing. If everything worked fine, an empty X screen will be shown. Type <em>Alt+Shift+Enter</em> and an <em>xterm</em> should appear occupying the entire screen.
</p>
<h2>Installing conky and dzen2</h2>
<p>
Again, you can install both those packages from source or via the package manager. I&#8217;ll show you how to install the latest versions from source.
</p>
<h3>Installing conky</h3>
<p>
Download the source tarball (at the time of the writing 1.8.1 was the latest version) from <a href="http://sourceforge.net/projects/conky/files/conky/" onclick="pageTracker._trackPageview('/outgoing/sourceforge.net/projects/conky/files/conky/?referer=');">sourceforge</a> and decompress it wherever you want:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf conky-1.8.1.tar.gz</pre></div></div>

</p>
<p>
Now run the typical commands to configure and install the package:
</p>
<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: #c20cb9; font-weight: bold;">make</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>
<p>
Note that you might need to install additional development libraries to configure and compile conky with all its bells and whistles, like <em>libxdamage-dev</em>, <em>libmpd-dev</em> and others. Do so with aptitude.
</p>
<h3>Installing dzen2</h3>
<p>
Download the latest source tarball (0.8.5 at the time of writing) from the <a href="https://sites.google.com/site/gotmor/dzen#Download" onclick="pageTracker._trackPageview('/outgoing/sites.google.com/site/gotmor/dzen_Download?referer=');">official home page</a> and uncompress it wherever you want:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf dzen2-latest.tar.gz</pre></div></div>

</p>
<p>
And then just compile and install it (have a look at the README if you want to add xft and xinerama support to it):
</p>
<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: #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>
<h2>The funny part begins: configuring xmonad and putting it all together</h2>
<p>
First of all, let me clarify some concepts. We will use xmonad as the Window Manager, dzen2 as the status bar and conky as a system data provider. Some people prefer to use <em>xmobar</em> instead of dzen2 + conky.
</p>
<p>
First of all, let me give credits to the resources I&#8217;ve used to craft xmonad the way I wanted:</p>
<ul>
<li><em>kveras</em> at Github gave me the overall skeleton of the configuration. Make sure to check his <a href="https://github.com/kveras/configs" onclick="pageTracker._trackPageview('/outgoing/github.com/kveras/configs?referer=');">configs</a> repository to have a look at his configs.</li>
<li><a href="http://haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen's_Configuration" onclick="pageTracker._trackPageview('/outgoing/haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen_s_Configuration?referer=');">Haskell Wiki</a> xmonad Config Archive, which provided some insights.</li>
</ul>
<p>
Xmonad configuration is done via a file in the <em>.xmonad</em> user folder called <em>xmonad.hs</em>. This file is Haskell code, and having a slight understanding of the Haskell syntax is recommended, although I managed to make this one without really having much Haskell knowledge.
</p>
<p>
Basically when you configure xmonad what you&#8217;re really doing is compiling it with the options you pass to it, via that configuration file. There are several things (AFAIK) that can be configured:</p>
<ul>
<li>The default terminal</li>
<li>The workspaces</li>
<li>The keybindings</li>
<li>The mod key</li>
<li>The Layout Hook</li>
<li>The Manage Hook</li>
<li>The Log Hook</li>
<li>Window border options</li>
</ul>
<p>The way everything is tied together is done when calling the main method of the configuration file:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">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
      <span style="color: green;">&#123;</span> terminal            <span style="color: #339933; font-weight: bold;">=</span> myTerminal
      <span style="color: #339933; font-weight: bold;">,</span> workspaces          <span style="color: #339933; font-weight: bold;">=</span> myWorkspaces
      <span style="color: #339933; font-weight: bold;">,</span> keys                <span style="color: #339933; font-weight: bold;">=</span> keys
      <span style="color: #339933; font-weight: bold;">,</span> modMask             <span style="color: #339933; font-weight: bold;">=</span> modMask
      <span style="color: #339933; font-weight: bold;">,</span> layoutHook          <span style="color: #339933; font-weight: bold;">=</span> layoutHook
      <span style="color: #339933; font-weight: bold;">,</span> manageHook          <span style="color: #339933; font-weight: bold;">=</span> manageHook
      <span style="color: #339933; font-weight: bold;">,</span> logHook             <span style="color: #339933; font-weight: bold;">=</span> myLogHook
      <span style="color: #339933; font-weight: bold;">,</span> normalBorderColor   <span style="color: #339933; font-weight: bold;">=</span> colorNormalBorder
      <span style="color: #339933; font-weight: bold;">,</span> focusedBorderColor  <span style="color: #339933; font-weight: bold;">=</span> colorFocusedBorder
      <span style="color: #339933; font-weight: bold;">,</span> borderWidth         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">2</span>
<span style="color: green;">&#125;</span></pre></div></div>

</p>
<p>
In that main method you use the defaultConfig and pass a list of the different parameters you want to customize. I&#8217;ll explain briefly every configuration aspect.
</p>
<h3>The default terminal</h3>
<p>
xmonad has a special function that is intended to be used to spawn a terminal. As a daily Linux programmer this is probably very useful. With the terminal parameter, then, you can specify the program that xmonad will launch when this action is invoked. Assigning this variable to the program name (assuming it&#8217;s in the path) is enough for it to work:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">myTerminal <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;gnome-terminal&quot;</span></pre></div></div>

</p>
<h3>The workspaces</h3>
<p>
xmonad allows you to group your windows into <em>workspaces</em>. The concept of workspace is very similar to the virtual desktops we have in Gnome, or the Spaces we have in Mac OS X. Each window will belong to a workspace, each workspace has a name and it&#8217;s own configuration, and one and only one workspace can be active (and shown) on one screen at the same time.
</p>
<p>
In the workspaces variable, we&#8217;ll tell xmonad our default list of workspaces we want to work with, in a form of a string list. In my configuration I&#8217;ve preceded every workspace name with a number:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">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:vim&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;4:chat&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;5:music&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;6:gimp&quot;</span><span style="color: green;">&#93;</span></pre></div></div>

</p>
<h3>The keybindings</h3>
<p>
Key binding is a crucial part of the configuration. One of the goals of xmonad is being able to do all window management without having to use the mouse, so your hands are always on the keyboard. Choosing a good key layout is then very important, and having a look at all the things you can do in xmonad is important, too, so you can check what you think it may be more useful to you. The key binding configuration is a bit strange in haskell, and I don&#8217;t entirely understand it myself, but I&#8217;ll try to guide you through the basics. Basically you have 3 modifiers: the <em>windows</em> key, <em>ctrl</em>, <em>shift</em> and <em>alt</em> (in fact I think you can deifne any key as a valid modifier, but those are the most used). You then configure pair of key-action, telling xmonad what should it do when certain keys are pressed. Those pairs have this syntax:
</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>modMask <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>Return   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="color: #339933; font-weight: bold;">$</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>terminal conf<span style="color: green;">&#41;</span></pre></div></div>

</p>
<p>
The first part tells xmonad the key press, while the second the action to be performed. The key press is expressed in the form of <em>modifier-key</em>. The modifiers can be chained, so you can assign some action when more than a modifier is pressed. In the example, we have <em>modMask .|. shiftMask, xK_Return</em>. This line means <em>press the modKey and the shift key, and then the return key</em>. As you can see, the operator to chain modifiers is <em>.|.</em>. When you want a key binding without modifier, you put a <em>0</em> instead. For instance, to bind a key to print the screen, you could use something like this: <em>((0, xK_Print), spawn &#8220;scrot -e &#8216;mv $f ~/screenshots/&#8217;&#8221;)</em>. This command tells xmonad to run the <em>scrot</em> program when the <em>Print Screen</em> key is pressed.
</p>
<p>
Some xmonad actions require a special attention: those used to manipulate the windows and the workspaces. I&#8217;ll tell you the most used ones (at least in the default configurations).</p>
<ul>
<li><em>sendMessage nextLayout</em> is used to tell xmonad to switch to the next layout in the current workspace</li>
<li><em>setLayout $ XMonad.layoutHook conf</em> will reset the current layout to the default one of the current workspace</li>
<li><em>sendMessage ToggleStruts</em> is used to switch between struts mode on and off. If I&#8217;m not mistaken, struts are margins put between windows (which by default are not shown)</li>
<li><em>windows W.focusDown</em> sets the focused window to the next window in the stack, allowing you to navigate the focus through different windows</li>
<li><em>windows W.focusUp</em> does the same as above but in the reverse order</li>
<li><em>windows W.swapDown</em> will swap the current window to the space occupied by the next window on the stack, useful to move windows between the different positions on the workspace</li>
<li><em>windows W.swapUp</em>, again, does the same as above in the reverse order</li>
<li><em>windows W.swapMaster</em> is very useful: it will put the focused window into the main space of the current layout (which is usually bigger than the other frames)</li>
<li><em>sendMessage Shrink</em> is used to shrink the size of the main frame size</li>
<li><em>sendMessage Expand</em>, on the other side, is used to expand the main frame size</li>
<li><em>sendMessage (IncMasterN number)</em> will increase the number of panes of the master pane by the given number (which can be a positive or negative integer)</li>
<li><em>nextWS</em> will switch to the next workspace</li>
<li><em>prevWS</em> will switch to the previous workspace</li>
<li><em>shiftToNext</em> will move the focused windo to the next workspace</li>
<li><em>shiftToPrev</em> will move the focused window to the previous workspace</li>
<li><em>W.shift workspace</em> will put the focused window to the selected workspace</li>
<li><em>W.view workspace</em> will put the selected workspace as the workspace of the screen</li>
</ul>
<p>
Here&#8217;s how the entire keys variable is assigned:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">keys' conf<span style="color: #339933; font-weight: bold;">@</span><span style="color: green;">&#40;</span>XConfig <span style="color: green;">&#123;</span>XMonad<span style="color: #339933; font-weight: bold;">.</span>modMask <span style="color: #339933; font-weight: bold;">=</span> modMask<span style="color: green;">&#125;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> M<span style="color: #339933; font-weight: bold;">.</span>fromList <span style="color: #339933; font-weight: bold;">$</span>
    <span style="color: green;">&#91;</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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: #339933; font-weight: bold;">,</span> runOrRaisePrompt largeXPConfig<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>Return   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="color: #339933; font-weight: bold;">$</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>terminal conf<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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;gmrun&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>c        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> kill<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>l        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;slock&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #5d478b; font-style: italic;">-- Programs</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>                          xK<span style="color: #339933; font-weight: bold;">_</span>Print    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;scrot -e 'mv $f ~/screenshots/'&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>		            xK<span style="color: #339933; font-weight: bold;">_</span>o        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;chromium-browser&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>m        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;nautilus --no-desktop --browser&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #5d478b; font-style: italic;">-- Media Keys</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 -q sset Headphone toggle&quot;</span><span style="color: green;">&#41;</span>        <span style="color: #5d478b; font-style: italic;">-- XF86AudioMute</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>                          0x1008ff11  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;amixer -q sset Headphone 5%-&quot;</span><span style="color: green;">&#41;</span>   <span style="color: #5d478b; font-style: italic;">-- XF86AudioLowerVolume</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>                          0x1008ff13  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;amixer -q sset Headphone 5%+&quot;</span><span style="color: green;">&#41;</span>   <span style="color: #5d478b; font-style: italic;">-- XF86AudioRaiseVolume</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>                          0x1008ff14  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --play-pause&quot;</span><span style="color: green;">&#41;</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>                          0x1008ff17  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --next&quot;</span><span style="color: green;">&#41;</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>                          0x1008ff16  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --previous&quot;</span><span style="color: green;">&#41;</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- layouts</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>space    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage NextLayout<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>space    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> setLayout <span style="color: #339933; font-weight: bold;">$</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>layoutHook conf<span style="color: green;">&#41;</span>          <span style="color: #5d478b; font-style: italic;">-- reset layout on current desktop to default</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>b        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage ToggleStruts<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>n        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> refresh<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>Tab      <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusDown<span style="color: green;">&#41;</span>                         <span style="color: #5d478b; font-style: italic;">-- move focus to next window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>j        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusDown<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>k        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusUp  <span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>j        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapDown<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- swap the focused window with the next window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>k        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapUp<span style="color: green;">&#41;</span>                            <span style="color: #5d478b; font-style: italic;">-- swap the focused window with the previous window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>Return   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapMaster<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>t        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> withFocused <span style="color: #339933; font-weight: bold;">$</span> windows <span style="color: #339933; font-weight: bold;">.</span> W<span style="color: #339933; font-weight: bold;">.</span>sink<span style="color: green;">&#41;</span>              <span style="color: #5d478b; font-style: italic;">-- Push window back into tiling</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>h        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage Shrink<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- %! Shrink a master area</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>l        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage Expand<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- %! Expand a master area</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>comma    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage <span style="color: green;">&#40;</span>IncMasterN <span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>period   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage <span style="color: green;">&#40;</span>IncMasterN <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
&nbsp;
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- workspaces</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>Left      <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> shiftToPrev<span style="color: green;">&#41;</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- quit, or restart</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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: #339933; font-weight: bold;">,</span> io <span style="color: green;">&#40;</span>exitWith ExitSuccess<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;killall conky dzen2 &amp;&amp; /home/brafales/.cabal/bin/xmonad --recompile &amp;&amp; /home/brafales/.cabal/bin/xmonad --restart&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: green;">&#93;</span>
    <span style="color: #339933; font-weight: bold;">++</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-[1..9] %! Switch to workspace N</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-shift-[1..9] %! Move client to workspace N</span>
    <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>m <span style="color: #339933; font-weight: bold;">.|.</span> modMask<span style="color: #339933; font-weight: bold;">,</span> k<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows <span style="color: #339933; font-weight: bold;">$</span> f i<span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">|</span> <span style="color: green;">&#40;</span>i<span style="color: #339933; font-weight: bold;">,</span> k<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#40;</span>XMonad<span style="color: #339933; font-weight: bold;">.</span>workspaces conf<span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span>xK<span style="color: #339933; font-weight: bold;">_</span>1 <span style="color: #339933; font-weight: bold;">..</span> xK<span style="color: #339933; font-weight: bold;">_</span>9<span style="color: green;">&#93;</span>
        <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>f<span style="color: #339933; font-weight: bold;">,</span> m<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>greedyView<span style="color: #339933; font-weight: bold;">,</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>shift<span style="color: #339933; font-weight: bold;">,</span> shiftMask<span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span>
    <span style="color: #339933; font-weight: bold;">++</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">--</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3</span>
    <span style="color: #5d478b; font-style: italic;">--</span>
    <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>m <span style="color: #339933; font-weight: bold;">.|.</span> modMask<span style="color: #339933; font-weight: bold;">,</span> key<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> screenWorkspace sc <span style="color: #339933; font-weight: bold;">&gt;&gt;=</span> <span style="font-weight: bold;">flip</span> whenJust <span style="color: green;">&#40;</span>windows <span style="color: #339933; font-weight: bold;">.</span> f<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">|</span> <span style="color: green;">&#40;</span>key<span style="color: #339933; font-weight: bold;">,</span> sc<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span>xK<span style="color: #339933; font-weight: bold;">_</span>w<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>e<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>r<span style="color: green;">&#93;</span> <span style="color: green;">&#91;</span><span style="color: red;">0</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span>
        <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>f<span style="color: #339933; font-weight: bold;">,</span> m<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>view<span style="color: #339933; font-weight: bold;">,</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>shift<span style="color: #339933; font-weight: bold;">,</span> shiftMask<span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span></pre></div></div>

</p>
<h3>The mod key</h3>
<p>
The mod key is the default key xmonad uses to prepend all the keybindings (usually). Some users configure it to <em>alt</em>, others to <em>ctrl</em>, others to the <em>windows key</em>. It&#8217;s up to you. In my config I have it configured to the windows key:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">modMask' <span style="color: #339933; font-weight: bold;">::</span> KeyMask
modMask' <span style="color: #339933; font-weight: bold;">=</span> mod4Mask</pre></div></div>

</p>
<h3>The Layout Hook</h3>
<p>
The layout hook is used to manage the layouts of the workspaces. xmonad is very configurable regarding the layouts you can use. By default, the windows are tiled by using half the screen (vertically) for the main frame, and equally sized horizontal windows for the other frames, but you can set it up however you want.
</p>
<p>
The syntax to configure the layouts is simple, you concatenate which layout you want to use for each workspace, leaving the last one as the default one:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">layoutHook'  <span style="color: #339933; font-weight: bold;">=</span>  onWorkspaces <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;5:music&quot;</span><span style="color: green;">&#93;</span> customLayout <span style="color: #339933; font-weight: bold;">$</span> 
                onWorkspaces <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;6:gimp&quot;</span><span style="color: green;">&#93;</span> gimpLayout <span style="color: #339933; font-weight: bold;">$</span> 
                onWorkspaces <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;4:chat&quot;</span><span style="color: green;">&#93;</span> imLayout <span style="color: #339933; font-weight: bold;">$</span>
                customLayout2</pre></div></div>

</p>
<p>
What&#8217;s not so easy is to configure those variables we used (customLayout, gimpLayout, imLayout, etc.), but you get the idea: you can configure each workspace to have its own layout, which is very useful. Here&#8217;s my <em>customLayout</em> variable so you can see how a layout is configured:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">customLayout <span style="color: #339933; font-weight: bold;">=</span> avoidStruts <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> Full <span style="color: #339933; font-weight: bold;">|||</span> simpleFloat
  <span style="color: #06c; font-weight: bold;">where</span>
    tiled   <span style="color: #339933; font-weight: bold;">=</span> ResizableTall <span style="color: red;">1</span> <span style="color: green;">&#40;</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">100</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">2</span><span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span></pre></div></div>

</p>
<p>
What I&#8217;m doing here is using <em>avoidstruts</em> to have a layout without margins between windows, and then passing a list of the different available layouts for the workspace, separated by the <em>|||</em> operator. This means that the default layout will be <em>tiled</em>, then <em>Mirror tiled</em>, etc. In this case, what Mirror does is swap the type of split, from vertical to horizontal. After that, I tell the config what I mean by <em>tiled</em>, in this case <em>ResizableTall 1 (2/200) (1/2) []</em>. What this means is to use the layout <em>ResizableTall</em> with 1 master window, the size of each resizing step, the width of the master panel and the slaves window height. You can check the full documentation for ResizableTall in the <a href="http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-ResizableTile.html" onclick="pageTracker._trackPageview('/outgoing/xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-ResizableTile.html?referer=');">XMonad.Layout.ResizableTile</a> documentation page.
</p>
<p>
The same way we&#8217;ve used ResizableTall for this customlayout, lots of extensions exist in xmonad that do all sorts of layout positioning.
</p>
<h3>The Manage Hook</h3>
<p>
The manage hook handles how new windows are positioned by default. xmonad allows you to put some windows into their own workspace, or in its own mode. This way, for example, you can have all Firefox windows to open in the &#8220;2:web&#8221; workspace, or have special program windows not to be tiled, but floated instead.
</p>
<p>
While I still don&#8217;t fully understand all the configuration options, this is a typical line to configure a manage hook:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: green;">&#91;</span>className    <span style="color: #339933; font-weight: bold;">=?</span> c            <span style="color: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;1:main&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myDev    <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move dev to main</span></pre></div></div>

</p>
<p>
What we&#8217;re doing with this line is tell xmonad that all windows which has a <em>classname</em> included in the <em>myDev</em> list must be shifted to the &#8220;1:main&#8221; workspace. I don&#8217;t know all the criteria you can use to identify a window, but the most used ones are the className and the role. You can check those X properties using the program <em>xprop</em> and clicking on the desired window.
</p>
<p>
Here&#8217;s my whole manage hook configuration:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">manageHook' <span style="color: #339933; font-weight: bold;">::</span> ManageHook
manageHook' <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</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: green;">&#91;</span>resource     <span style="color: #339933; font-weight: bold;">=?</span> r            <span style="color: #339933; font-weight: bold;">--&gt;</span> doIgnore            <span style="color: #339933; font-weight: bold;">|</span>   r   <span style="color: #339933; font-weight: bold;">&lt;-</span> myIgnores<span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- ignore desktop</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;1:main&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myDev    <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move dev to main</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;2:web&quot;</span>    <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myWebs   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move webs to main</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;3:vim&quot;</span>    <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myVim    <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move webs to main</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: #339933; font-weight: bold;">--&gt;</span> doShift	 <span style="background-color: #3cb371;">&quot;4:chat&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myChat   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move chat 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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;5:music&quot;</span>  <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myMusic  <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move music to music</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;6:gimp&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myGimp   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move img to div</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: #339933; font-weight: bold;">--&gt;</span> doCenterFloat       <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myFloats <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- float my floats</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span>name         <span style="color: #339933; font-weight: bold;">=?</span> n            <span style="color: #339933; font-weight: bold;">--&gt;</span> doCenterFloat       <span style="color: #339933; font-weight: bold;">|</span>   n   <span style="color: #339933; font-weight: bold;">&lt;-</span> myNames  <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- float my names</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span>isFullscreen                 <span style="color: #339933; font-weight: bold;">--&gt;</span> myDoFullFloat                           <span style="color: green;">&#93;</span>
    <span style="color: green;">&#93;</span><span style="color: green;">&#41;</span> 
&nbsp;
    <span style="color: #06c; font-weight: bold;">where</span>
&nbsp;
        role      <span style="color: #339933; font-weight: bold;">=</span> stringProperty <span style="background-color: #3cb371;">&quot;WM_WINDOW_ROLE&quot;</span>
        name      <span style="color: #339933; font-weight: bold;">=</span> stringProperty <span style="background-color: #3cb371;">&quot;WM_NAME&quot;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- classnames</span>
        myFloats  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Smplayer&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;MPlayer&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;VirtualBox&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Xmessage&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;XFontSel&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Downloads&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Nm-connection-editor&quot;</span><span style="color: green;">&#93;</span>
        myWebs    <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;Google-chrome&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Chromium&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;Chromium-browser&quot;</span><span style="color: green;">&#93;</span>
        myMovie   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Boxee&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Trine&quot;</span><span style="color: green;">&#93;</span>
        myMusic	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Rhythmbox&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Spotify&quot;</span><span style="color: green;">&#93;</span>
        myChat	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Pidgin&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Buddy List&quot;</span><span style="color: green;">&#93;</span>
        myGimp	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Gimp&quot;</span><span style="color: green;">&#93;</span>
        myDev	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;gnome-terminal&quot;</span><span style="color: green;">&#93;</span>
        myVim	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Gvim&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- resources</span>
        myIgnores <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;desktop&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;desktop_window&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;notify-osd&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;stalonetray&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;trayer&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- names</span>
        myNames   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;bashrun&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Google Chrome Options&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Chromium Options&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- a trick for fullscreen but stil allow focusing of other WSs</span>
        myDoFullFloat <span style="color: #339933; font-weight: bold;">::</span> ManageHook
        myDoFullFloat <span style="color: #339933; font-weight: bold;">=</span> doF W<span style="color: #339933; font-weight: bold;">.</span>focusDown <span style="color: #339933; font-weight: bold;">&lt;+&gt;</span> doFullFloat</pre></div></div>

</p>
<h3>The Log Hook</h3>
<p>
The log hook is what xmonad uses to tell us information about itself. Usually this hook is used in conjunction with other modules such as <em>xmobar</em> or, in my case, <em>dzen2</em>. It tells us info about the status of the different workspaces, selected windows, etcetera. When configuring this hook, you usually pipe its result to the pipe you want to use to show the info.
</p>
<p>
The log hook is also very customizable, you can select colors and icons to be shown. The <a href="http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html#v:dynamicLogWithPP" onclick="pageTracker._trackPageview('/outgoing/xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html_v_dynamicLogWithPP?referer=');">documentation page for dynamicLogWithPP</a> shows you all the options. In my configuration, because I use dzen2 as a status bar, I also use some helpers for the colors:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">myLogHook <span style="color: #339933; font-weight: bold;">::</span> Handle <span style="color: #339933; font-weight: bold;">-&gt;</span> 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;#ebac54&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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;#1B1D1E&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;#1B1D1E&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;#7b7b7b&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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;#ff0000&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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> ppLayout            <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;#ebac54&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&quot;</span> <span style="color: #339933; font-weight: bold;">.</span>
                                <span style="color: green;">&#40;</span>\x <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #06c; font-weight: bold;">case</span> x <span style="color: #06c; font-weight: bold;">of</span>
                                    <span style="background-color: #3cb371;">&quot;ResizableTall&quot;</span>             <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/tall.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Mirror ResizableTall&quot;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/mtall.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Full&quot;</span>                      <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/full.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Simple Float&quot;</span>              <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;~&quot;</span>
                                    <span style="color: #339933; font-weight: bold;">_</span>                           <span style="color: #339933; font-weight: bold;">-&gt;</span>      x
                                <span style="color: green;">&#41;</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;#1B1D1E&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>
<p>
As you can see, I can set the colors for the different workspace statuses, and some icons to be able to know which is the current workspace layout. The last line is very important, as it&#8217;s the line that outputs the results to wherever we choose.
</p>
<h3>dzen2 and conky</h3>
<p>
As I told you at the beginning, I&#8217;m using dzen2 as a status bar, and conky to get some fancy system information. To configure this, we have to tell xmonad to spawn the dzen2 and conky processes at the beginning. This can be done inside the main method, and here&#8217;s how it looks like in my configuration:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">myXmonadBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;dzen2 -x '1440' -y '0' -h '24' -w '640' -ta 'l' -fg '#FFFFFF' -bg '#1B1D1E'&quot;</span>
myStatusBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;conky -c /home/my_user/.xmonad/.conky_dzen | dzen2 -x '2080' -w '1040' -h '24' -ta 'r' -bg '#1B1D1E' -fg '#FFFFFF' -y '0'&quot;</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    dzenLeftBar <span style="color: #339933; font-weight: bold;">&lt;-</span> spawnPipe myXmonadBar
    dzenRightBar <span style="color: #339933; font-weight: bold;">&lt;-</span> spawnPipe myStatusBar
    xmonad <span style="color: #339933; font-weight: bold;">$</span> defaultConfig
      <span style="color: green;">&#123;</span> terminal            <span style="color: #339933; font-weight: bold;">=</span> myTerminal
      <span style="color: #339933; font-weight: bold;">,</span> workspaces          <span style="color: #339933; font-weight: bold;">=</span> myWorkspaces
      <span style="color: #339933; font-weight: bold;">,</span> keys                <span style="color: #339933; font-weight: bold;">=</span> keys'
      <span style="color: #339933; font-weight: bold;">,</span> modMask             <span style="color: #339933; font-weight: bold;">=</span> modMask'
      <span style="color: #339933; font-weight: bold;">,</span> layoutHook          <span style="color: #339933; font-weight: bold;">=</span> layoutHook'
      <span style="color: #339933; font-weight: bold;">,</span> manageHook          <span style="color: #339933; font-weight: bold;">=</span> manageHook'
      <span style="color: #339933; font-weight: bold;">,</span> logHook             <span style="color: #339933; font-weight: bold;">=</span> myLogHook dzenLeftBar <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> fadeInactiveLogHook 0xdddddddd
      <span style="color: #339933; font-weight: bold;">,</span> normalBorderColor   <span style="color: #339933; font-weight: bold;">=</span> colorNormalBorder
      <span style="color: #339933; font-weight: bold;">,</span> focusedBorderColor  <span style="color: #339933; font-weight: bold;">=</span> colorFocusedBorder
      <span style="color: #339933; font-weight: bold;">,</span> borderWidth         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">2</span>
<span style="color: green;">&#125;</span></pre></div></div>

</p>
<p>
Notice that I use two different bars. I&#8217;ll use the left one for xmonad info and the right one for system info. What&#8217;s most important here are the coordinates and size of the bars, and also the configuration file for conky. After spawning the processes, in the main method we tell xmonad to use the <em>dzenLeftBar</em> pipe to output the log info.
</p>
<p>
The right bar is piped to use the conky output, as configured in the <em>.conky_dzen</em> configuration. Conky has lots of options, covered in the <a href="http://conky.sourceforge.net/variables.html" onclick="pageTracker._trackPageview('/outgoing/conky.sourceforge.net/variables.html?referer=');">Conky Objects</a> documentation page. Here&#8217;s my config:
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">background yes
out_to_console yes
out_to_x no
# Update interval in seconds
update_interval 1
&nbsp;
TEXT
^i(/home/my_user/.xmonad/dzen2/cpu.xbm) ^fg(\#FFFFFF)${cpu}% ^i(/home/my_user/.xmonad/dzen2/mem.xbm) ^fg(\#FFFFFF)${memperc}% ^fg(\#ebac54) ${if_existing /proc/net/route eth1} ^i(/home/my_user/.xmonad/dzen2/net_wired.xbm) ^fg(\#00aa4a) ^i(/home/my_user/.xmonad/dzen2/net_down_03.xbm)${downspeed eth1} ^fg(\#ff3333) ^i(/home/my_user/.xmonad/dzen2/net_up_03.xbm)${upspeed eth1} ^fg(\#ebac54) ^i(/home/my_user/.xmonad/dzen2/mpd.xbm) ^fg(\#00ffff)${exec rhythmbox-client --print-playing-format &quot;%aa-%at-%tt&quot; | cut -c-70} ^fg(\#ebac54) ^i(/home/my_user/.xmonad/dzen2/volume.xbm) ^fg(\#00ffff)${exec amixer get Headphone | egrep -o &quot;[0-9]+%&quot; | head -1 | egrep -o &quot;[0-9]*&quot;}% ^fg(\#ebac54) ^i(/home/my_user/.xmonad/dzen2/clock.xbm) ^fg(\#FFFFFF) ${time %d %m %Y} ^fg(\#ebac54) ${time %R}</pre></div></div>

</p>
<p>
The important things here are the background line and the out_to_x line, which tell conky to run in the background and not to output the results directly to the X. You can then configure the <em>TEXT</em> variable to display whatever variables you want.
</p>
<h3>Putting it all together</h3>
<p>
After all the work is done, it&#8217;s time to finally put it all together. Here&#8217;s the final configuration file that I currently use and that I&#8217;ve been showing you in this post:
</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #5d478b; font-style: italic;">-- ~/.xmonad/xmonad.hs</span>
<span style="color: #5d478b; font-style: italic;">-- Imports {{{</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad
<span style="color: #5d478b; font-style: italic;">-- Prompt</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Prompt
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Prompt<span style="color: #339933; font-weight: bold;">.</span>RunOrRaise <span style="color: green;">&#40;</span>runOrRaisePrompt<span style="color: green;">&#41;</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Prompt<span style="color: #339933; font-weight: bold;">.</span>AppendFile <span style="color: green;">&#40;</span>appendFilePrompt<span style="color: green;">&#41;</span>
<span style="color: #5d478b; font-style: italic;">-- Hooks</span>
<span style="color: #06c; font-weight: bold;">import</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>Operations
&nbsp;
<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>
<span style="color: #06c; font-weight: bold;">import</span> System<span style="color: #339933; font-weight: bold;">.</span>Exit
&nbsp;
<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
&nbsp;
&nbsp;
<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: #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
<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>ManageHelpers
<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>SetWMName
<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> 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>Hooks<span style="color: #339933; font-weight: bold;">.</span>EwmhDesktops
&nbsp;
<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>smartBorders<span style="color: #339933; font-weight: bold;">,</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: #339933; font-weight: bold;">,</span> onWorkspaces<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>Reflect <span style="color: green;">&#40;</span>reflectHoriz<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>IM
<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>Spacing
<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>ResizableTile
<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>LayoutHints
<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>LayoutModifier
<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>Grid
&nbsp;
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span>Ratio <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">%</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
&nbsp;
<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
<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;">--}}}</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Config {{{</span>
<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&quot;</span>
<span style="color: #5d478b; font-style: italic;">-- Define modMask</span>
modMask' <span style="color: #339933; font-weight: bold;">::</span> KeyMask
modMask' <span style="color: #339933; font-weight: bold;">=</span> mod4Mask
<span style="color: #5d478b; font-style: italic;">-- Define 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:vim&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;4:chat&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;5:music&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;6:gimp&quot;</span><span style="color: green;">&#93;</span>
<span style="color: #5d478b; font-style: italic;">-- Dzen/Conky</span>
myXmonadBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;dzen2 -x '1440' -y '0' -h '24' -w '640' -ta 'l' -fg '#FFFFFF' -bg '#1B1D1E'&quot;</span>
myStatusBar <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;conky -c /home/my_user/.xmonad/.conky_dzen | dzen2 -x '2080' -w '1040' -h '24' -ta 'r' -bg '#1B1D1E' -fg '#FFFFFF' -y '0'&quot;</span>
myBitmapsDir <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;/home/my_user/.xmonad/dzen2&quot;</span>
<span style="color: #5d478b; font-style: italic;">--}}}</span>
<span style="color: #5d478b; font-style: italic;">-- Main {{{</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    dzenLeftBar <span style="color: #339933; font-weight: bold;">&lt;-</span> spawnPipe myXmonadBar
    dzenRightBar <span style="color: #339933; font-weight: bold;">&lt;-</span> spawnPipe myStatusBar
    xmonad <span style="color: #339933; font-weight: bold;">$</span> defaultConfig
      <span style="color: green;">&#123;</span> terminal            <span style="color: #339933; font-weight: bold;">=</span> myTerminal
      <span style="color: #339933; font-weight: bold;">,</span> workspaces          <span style="color: #339933; font-weight: bold;">=</span> myWorkspaces
      <span style="color: #339933; font-weight: bold;">,</span> keys                <span style="color: #339933; font-weight: bold;">=</span> keys'
      <span style="color: #339933; font-weight: bold;">,</span> modMask             <span style="color: #339933; font-weight: bold;">=</span> modMask'
      <span style="color: #339933; font-weight: bold;">,</span> layoutHook          <span style="color: #339933; font-weight: bold;">=</span> layoutHook'
      <span style="color: #339933; font-weight: bold;">,</span> manageHook          <span style="color: #339933; font-weight: bold;">=</span> manageHook'
      <span style="color: #339933; font-weight: bold;">,</span> logHook             <span style="color: #339933; font-weight: bold;">=</span> myLogHook dzenLeftBar <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> fadeInactiveLogHook 0xdddddddd
      <span style="color: #339933; font-weight: bold;">,</span> normalBorderColor   <span style="color: #339933; font-weight: bold;">=</span> colorNormalBorder
      <span style="color: #339933; font-weight: bold;">,</span> focusedBorderColor  <span style="color: #339933; font-weight: bold;">=</span> colorFocusedBorder
      <span style="color: #339933; font-weight: bold;">,</span> borderWidth         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">2</span>
<span style="color: green;">&#125;</span>
<span style="color: #5d478b; font-style: italic;">--}}}</span>
&nbsp;
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Hooks {{{</span>
<span style="color: #5d478b; font-style: italic;">-- ManageHook {{{</span>
manageHook' <span style="color: #339933; font-weight: bold;">::</span> ManageHook
manageHook' <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</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: green;">&#91;</span>resource     <span style="color: #339933; font-weight: bold;">=?</span> r            <span style="color: #339933; font-weight: bold;">--&gt;</span> doIgnore            <span style="color: #339933; font-weight: bold;">|</span>   r   <span style="color: #339933; font-weight: bold;">&lt;-</span> myIgnores<span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- ignore desktop</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;1:main&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myDev    <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move dev to main</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;2:web&quot;</span>    <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myWebs   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move webs to main</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;3:vim&quot;</span>    <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myVim    <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move webs to main</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: #339933; font-weight: bold;">--&gt;</span> doShift	 <span style="background-color: #3cb371;">&quot;4:chat&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myChat   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move chat 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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;5:music&quot;</span>  <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myMusic  <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move music to music</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: #339933; font-weight: bold;">--&gt;</span> doShift  <span style="background-color: #3cb371;">&quot;6:gimp&quot;</span>   <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myGimp   <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- move img to div</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: #339933; font-weight: bold;">--&gt;</span> doCenterFloat       <span style="color: #339933; font-weight: bold;">|</span>   c   <span style="color: #339933; font-weight: bold;">&lt;-</span> myFloats <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- float my floats</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span>name         <span style="color: #339933; font-weight: bold;">=?</span> n            <span style="color: #339933; font-weight: bold;">--&gt;</span> doCenterFloat       <span style="color: #339933; font-weight: bold;">|</span>   n   <span style="color: #339933; font-weight: bold;">&lt;-</span> myNames  <span style="color: green;">&#93;</span> <span style="color: #5d478b; font-style: italic;">-- float my names</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span>isFullscreen                 <span style="color: #339933; font-weight: bold;">--&gt;</span> myDoFullFloat                           <span style="color: green;">&#93;</span>
    <span style="color: green;">&#93;</span><span style="color: green;">&#41;</span> 
&nbsp;
    <span style="color: #06c; font-weight: bold;">where</span>
&nbsp;
        role      <span style="color: #339933; font-weight: bold;">=</span> stringProperty <span style="background-color: #3cb371;">&quot;WM_WINDOW_ROLE&quot;</span>
        name      <span style="color: #339933; font-weight: bold;">=</span> stringProperty <span style="background-color: #3cb371;">&quot;WM_NAME&quot;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- classnames</span>
        myFloats  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Smplayer&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;MPlayer&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;VirtualBox&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Xmessage&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;XFontSel&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Downloads&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Nm-connection-editor&quot;</span><span style="color: green;">&#93;</span>
        myWebs    <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;Google-chrome&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Chromium&quot;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;Chromium-browser&quot;</span><span style="color: green;">&#93;</span>
        myMovie   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Boxee&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Trine&quot;</span><span style="color: green;">&#93;</span>
        myMusic	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Rhythmbox&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Spotify&quot;</span><span style="color: green;">&#93;</span>
        myChat	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Pidgin&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Buddy List&quot;</span><span style="color: green;">&#93;</span>
        myGimp	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Gimp&quot;</span><span style="color: green;">&#93;</span>
        myDev	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;gnome-terminal&quot;</span><span style="color: green;">&#93;</span>
        myVim	  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;Gvim&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- resources</span>
        myIgnores <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;desktop&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;desktop_window&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;notify-osd&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;stalonetray&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;trayer&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
        <span style="color: #5d478b; font-style: italic;">-- names</span>
        myNames   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;bashrun&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Google Chrome Options&quot;</span><span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;Chromium Options&quot;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- a trick for fullscreen but stil allow focusing of other WSs</span>
myDoFullFloat <span style="color: #339933; font-weight: bold;">::</span> ManageHook
myDoFullFloat <span style="color: #339933; font-weight: bold;">=</span> doF W<span style="color: #339933; font-weight: bold;">.</span>focusDown <span style="color: #339933; font-weight: bold;">&lt;+&gt;</span> doFullFloat
<span style="color: #5d478b; font-style: italic;">-- }}}</span>
layoutHook'  <span style="color: #339933; font-weight: bold;">=</span>  onWorkspaces <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;5:music&quot;</span><span style="color: green;">&#93;</span> customLayout <span style="color: #339933; font-weight: bold;">$</span> 
                onWorkspaces <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;6:gimp&quot;</span><span style="color: green;">&#93;</span> gimpLayout <span style="color: #339933; font-weight: bold;">$</span> 
                onWorkspaces <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;4:chat&quot;</span><span style="color: green;">&#93;</span> imLayout <span style="color: #339933; font-weight: bold;">$</span>
                customLayout2
&nbsp;
<span style="color: #5d478b; font-style: italic;">--Bar</span>
myLogHook <span style="color: #339933; font-weight: bold;">::</span> Handle <span style="color: #339933; font-weight: bold;">-&gt;</span> 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;#ebac54&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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;#1B1D1E&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;#1B1D1E&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;#7b7b7b&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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;#ff0000&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&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> ppLayout            <span style="color: #339933; font-weight: bold;">=</span>   dzenColor <span style="background-color: #3cb371;">&quot;#ebac54&quot;</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&quot;</span> <span style="color: #339933; font-weight: bold;">.</span>
                                <span style="color: green;">&#40;</span>\x <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #06c; font-weight: bold;">case</span> x <span style="color: #06c; font-weight: bold;">of</span>
                                    <span style="background-color: #3cb371;">&quot;ResizableTall&quot;</span>             <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/tall.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Mirror ResizableTall&quot;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/mtall.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Full&quot;</span>                      <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;^i(&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> myBitmapsDir <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;/full.xbm)&quot;</span>
                                    <span style="background-color: #3cb371;">&quot;Simple Float&quot;</span>              <span style="color: #339933; font-weight: bold;">-&gt;</span>      <span style="background-color: #3cb371;">&quot;~&quot;</span>
                                    <span style="color: #339933; font-weight: bold;">_</span>                           <span style="color: #339933; font-weight: bold;">-&gt;</span>      x
                                <span style="color: green;">&#41;</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;#1B1D1E&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>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Layout</span>
customLayout <span style="color: #339933; font-weight: bold;">=</span> avoidStruts <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> Full <span style="color: #339933; font-weight: bold;">|||</span> simpleFloat
  <span style="color: #06c; font-weight: bold;">where</span>
    tiled   <span style="color: #339933; font-weight: bold;">=</span> ResizableTall <span style="color: red;">1</span> <span style="color: green;">&#40;</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">100</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">2</span><span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
&nbsp;
customLayout2 <span style="color: #339933; font-weight: bold;">=</span> avoidStruts <span style="color: #339933; font-weight: bold;">$</span> Full <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: #06c; font-weight: bold;">where</span>
    tiled   <span style="color: #339933; font-weight: bold;">=</span> ResizableTall <span style="color: red;">1</span> <span style="color: green;">&#40;</span><span style="color: red;">2</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">100</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">/</span><span style="color: red;">2</span><span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
&nbsp;
gimpLayout  <span style="color: #339933; font-weight: bold;">=</span> avoidStruts <span style="color: #339933; font-weight: bold;">$</span> withIM <span style="color: green;">&#40;</span><span style="color: red;">0.11</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>Role <span style="background-color: #3cb371;">&quot;gimp-toolbox&quot;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span>
              reflectHoriz <span style="color: #339933; font-weight: bold;">$</span>
              withIM <span style="color: green;">&#40;</span><span style="color: red;">0.15</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>Role <span style="background-color: #3cb371;">&quot;gimp-dock&quot;</span><span style="color: green;">&#41;</span> Full
&nbsp;
imLayout    <span style="color: #339933; font-weight: bold;">=</span> avoidStruts <span style="color: #339933; font-weight: bold;">$</span> withIM <span style="color: green;">&#40;</span><span style="color: red;">1</span><span style="color: #339933; font-weight: bold;">%</span>5<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>And <span style="color: green;">&#40;</span>ClassName <span style="background-color: #3cb371;">&quot;Pidgin&quot;</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>Role <span style="background-color: #3cb371;">&quot;buddy_list&quot;</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> Grid 
<span style="color: #5d478b; font-style: italic;">--}}}</span>
<span style="color: #5d478b; font-style: italic;">-- Theme {{{</span>
<span style="color: #5d478b; font-style: italic;">-- Color names are easier to remember:</span>
colorOrange         <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#FD971F&quot;</span>
colorDarkGray       <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#1B1D1E&quot;</span>
colorPink           <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#F92672&quot;</span>
colorGreen          <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#A6E22E&quot;</span>
colorBlue           <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#66D9EF&quot;</span>
colorYellow         <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#E6DB74&quot;</span>
colorWhite          <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#CCCCC6&quot;</span>
&nbsp;
colorNormalBorder   <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#CCCCC6&quot;</span>
colorFocusedBorder  <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;#fd971f&quot;</span>
&nbsp;
&nbsp;
barFont  <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;terminus&quot;</span>
barXFont <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;inconsolata:size=12&quot;</span>
xftFont <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;xft: inconsolata-14&quot;</span>
<span style="color: #5d478b; font-style: italic;">--}}}</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Prompt Config {{{</span>
mXPConfig <span style="color: #339933; font-weight: bold;">::</span> XPConfig
mXPConfig <span style="color: #339933; font-weight: bold;">=</span>
    defaultXPConfig <span style="color: green;">&#123;</span> font                  <span style="color: #339933; font-weight: bold;">=</span> barFont
                    <span style="color: #339933; font-weight: bold;">,</span> bgColor               <span style="color: #339933; font-weight: bold;">=</span> colorDarkGray
                    <span style="color: #339933; font-weight: bold;">,</span> fgColor               <span style="color: #339933; font-weight: bold;">=</span> colorGreen
                    <span style="color: #339933; font-weight: bold;">,</span> bgHLight              <span style="color: #339933; font-weight: bold;">=</span> colorGreen
                    <span style="color: #339933; font-weight: bold;">,</span> fgHLight              <span style="color: #339933; font-weight: bold;">=</span> colorDarkGray
                    <span style="color: #339933; font-weight: bold;">,</span> promptBorderWidth     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">0</span>
                    <span style="color: #339933; font-weight: bold;">,</span> height                <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">14</span>
                    <span style="color: #339933; font-weight: bold;">,</span> historyFilter         <span style="color: #339933; font-weight: bold;">=</span> deleteConsecutive
                    <span style="color: green;">&#125;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Run or Raise Menu</span>
largeXPConfig <span style="color: #339933; font-weight: bold;">::</span> XPConfig
largeXPConfig <span style="color: #339933; font-weight: bold;">=</span> mXPConfig
                <span style="color: green;">&#123;</span> font <span style="color: #339933; font-weight: bold;">=</span> xftFont
                <span style="color: #339933; font-weight: bold;">,</span> height <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">22</span>
                <span style="color: green;">&#125;</span>
<span style="color: #5d478b; font-style: italic;">-- }}}</span>
<span style="color: #5d478b; font-style: italic;">-- Key mapping {{{</span>
keys' conf<span style="color: #339933; font-weight: bold;">@</span><span style="color: green;">&#40;</span>XConfig <span style="color: green;">&#123;</span>XMonad<span style="color: #339933; font-weight: bold;">.</span>modMask <span style="color: #339933; font-weight: bold;">=</span> modMask<span style="color: green;">&#125;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> M<span style="color: #339933; font-weight: bold;">.</span>fromList <span style="color: #339933; font-weight: bold;">$</span>
    <span style="color: green;">&#91;</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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: #339933; font-weight: bold;">,</span> runOrRaisePrompt largeXPConfig<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>Return   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="color: #339933; font-weight: bold;">$</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>terminal conf<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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;gmrun&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>c        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> kill<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>l        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;slock&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #5d478b; font-style: italic;">-- Programs</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>                          xK<span style="color: #339933; font-weight: bold;">_</span>Print    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;scrot -e 'mv $f ~/screenshots/'&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>		            xK<span style="color: #339933; font-weight: bold;">_</span>o        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;chromium-browser&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>m        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;nautilus --no-desktop --browser&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: #5d478b; font-style: italic;">-- Media Keys</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 -q sset Headphone toggle&quot;</span><span style="color: green;">&#41;</span>        <span style="color: #5d478b; font-style: italic;">-- XF86AudioMute</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>                          0x1008ff11  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;amixer -q sset Headphone 5%-&quot;</span><span style="color: green;">&#41;</span>   <span style="color: #5d478b; font-style: italic;">-- XF86AudioLowerVolume</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>                          0x1008ff13  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;amixer -q sset Headphone 5%+&quot;</span><span style="color: green;">&#41;</span>   <span style="color: #5d478b; font-style: italic;">-- XF86AudioRaiseVolume</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>                          0x1008ff14  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --play-pause&quot;</span><span style="color: green;">&#41;</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>                          0x1008ff17  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --next&quot;</span><span style="color: green;">&#41;</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>                          0x1008ff16  <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;rhythmbox-client --previous&quot;</span><span style="color: green;">&#41;</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- layouts</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>space    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage NextLayout<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>space    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> setLayout <span style="color: #339933; font-weight: bold;">$</span> XMonad<span style="color: #339933; font-weight: bold;">.</span>layoutHook conf<span style="color: green;">&#41;</span>          <span style="color: #5d478b; font-style: italic;">-- reset layout on current desktop to default</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>b        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage ToggleStruts<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>n        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> refresh<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>Tab      <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusDown<span style="color: green;">&#41;</span>                         <span style="color: #5d478b; font-style: italic;">-- move focus to next window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>j        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusDown<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>k        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>focusUp  <span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>j        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapDown<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- swap the focused window with the next window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>k        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapUp<span style="color: green;">&#41;</span>                            <span style="color: #5d478b; font-style: italic;">-- swap the focused window with the previous window</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>Return   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows W<span style="color: #339933; font-weight: bold;">.</span>swapMaster<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>t        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> withFocused <span style="color: #339933; font-weight: bold;">$</span> windows <span style="color: #339933; font-weight: bold;">.</span> W<span style="color: #339933; font-weight: bold;">.</span>sink<span style="color: green;">&#41;</span>              <span style="color: #5d478b; font-style: italic;">-- Push window back into tiling</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>h        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage Shrink<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- %! Shrink a master area</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>l        <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage Expand<span style="color: green;">&#41;</span>                          <span style="color: #5d478b; font-style: italic;">-- %! Expand a master area</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>comma    <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage <span style="color: green;">&#40;</span>IncMasterN <span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<span style="color: #339933; font-weight: bold;">,</span>                    xK<span style="color: #339933; font-weight: bold;">_</span>period   <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> sendMessage <span style="color: green;">&#40;</span>IncMasterN <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
&nbsp;
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- workspaces</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <span style="color: #339933; font-weight: bold;">.|.</span> controlMask<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: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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>Left      <span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> shiftToPrev<span style="color: green;">&#41;</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">-- quit, or restart</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask <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: #339933; font-weight: bold;">,</span> io <span style="color: green;">&#40;</span>exitWith ExitSuccess<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>modMask<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: #339933; font-weight: bold;">,</span> spawn <span style="background-color: #3cb371;">&quot;killall conky dzen2 &amp;&amp; /home/my_user/.cabal/bin/xmonad --recompile &amp;&amp; /home/my_user/.cabal/bin/xmonad --restart&quot;</span><span style="color: green;">&#41;</span>
    <span style="color: green;">&#93;</span>
    <span style="color: #339933; font-weight: bold;">++</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-[1..9] %! Switch to workspace N</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-shift-[1..9] %! Move client to workspace N</span>
    <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>m <span style="color: #339933; font-weight: bold;">.|.</span> modMask<span style="color: #339933; font-weight: bold;">,</span> k<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> windows <span style="color: #339933; font-weight: bold;">$</span> f i<span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">|</span> <span style="color: green;">&#40;</span>i<span style="color: #339933; font-weight: bold;">,</span> k<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#40;</span>XMonad<span style="color: #339933; font-weight: bold;">.</span>workspaces conf<span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span>xK<span style="color: #339933; font-weight: bold;">_</span>1 <span style="color: #339933; font-weight: bold;">..</span> xK<span style="color: #339933; font-weight: bold;">_</span>9<span style="color: green;">&#93;</span>
        <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>f<span style="color: #339933; font-weight: bold;">,</span> m<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>greedyView<span style="color: #339933; font-weight: bold;">,</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>shift<span style="color: #339933; font-weight: bold;">,</span> shiftMask<span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span>
    <span style="color: #339933; font-weight: bold;">++</span>
&nbsp;
    <span style="color: #5d478b; font-style: italic;">--</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3</span>
    <span style="color: #5d478b; font-style: italic;">-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3</span>
    <span style="color: #5d478b; font-style: italic;">--</span>
    <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>m <span style="color: #339933; font-weight: bold;">.|.</span> modMask<span style="color: #339933; font-weight: bold;">,</span> key<span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> screenWorkspace sc <span style="color: #339933; font-weight: bold;">&gt;&gt;=</span> <span style="font-weight: bold;">flip</span> whenJust <span style="color: green;">&#40;</span>windows <span style="color: #339933; font-weight: bold;">.</span> f<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">|</span> <span style="color: green;">&#40;</span>key<span style="color: #339933; font-weight: bold;">,</span> sc<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span>xK<span style="color: #339933; font-weight: bold;">_</span>w<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>e<span style="color: #339933; font-weight: bold;">,</span> xK<span style="color: #339933; font-weight: bold;">_</span>r<span style="color: green;">&#93;</span> <span style="color: green;">&#91;</span><span style="color: red;">0</span><span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span>
        <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>f<span style="color: #339933; font-weight: bold;">,</span> m<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>view<span style="color: #339933; font-weight: bold;">,</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>W<span style="color: #339933; font-weight: bold;">.</span>shift<span style="color: #339933; font-weight: bold;">,</span> shiftMask<span style="color: green;">&#41;</span><span style="color: green;">&#93;</span><span style="color: green;">&#93;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">--}}}</span>
<span style="color: #5d478b; font-style: italic;">-- vim:foldmethod=marker sw=4 sts=4 ts=4 tw=0 et ai nowrap</span></pre></div></div>

</p>
<p>
Copy this into your .xmonad folder, assuming you have everything needed, and you should see a desktop similar to the one shown on the image.
</p>
<p>
Feel free to check my <a href="http://github.com/brafales/xmonad-config" onclick="pageTracker._trackPageview('/outgoing/github.com/brafales/xmonad-config?referer=');">GitHub xmonad repository</a> to find updated configuration files.
</p>
<p>
Cheers!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fthinkingeek.com%2F2011%2F11%2F21%2Fsimple-guide-configure-xmonad-dzen2-conky%2F&amp;title=Simple%20guide%20to%20configure%20xmonad%2C%20dzen2%20and%20conky" id="wpa2a_2" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save_url=http_3A_2F_2Fthinkingeek.com_2F2011_2F11_2F21_2Fsimple-guide-configure-xmonad-dzen2-conky_2F_amp_title=Simple_20guide_20to_20configure_20xmonad_2C_20dzen2_20and_20conky?referer=');"><img src="http://thinkingeek.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://thinkingeek.com/2011/11/21/simple-guide-configure-xmonad-dzen2-conky/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing dropbox and dropbox-nautilus in ArchLinux</title>
		<link>http://thinkingeek.com/2011/02/18/installing-dropbox-and-dropbox-nautilus-in-archlinux/</link>
		<comments>http://thinkingeek.com/2011/02/18/installing-dropbox-and-dropbox-nautilus-in-archlinux/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 14:19:30 +0000</pubDate>
		<dc:creator>brafales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nautilus]]></category>

		<guid isPermaLink="false">http://thinkingeek.com/?p=151</guid>
		<description><![CDATA[If you&#8217;ve tried to install dropbox-nautilus from the source found in the Dropbox website, you&#8217;ll find that you can&#8217;t successfully complete the ./configure step of the package due to an error of the script not finding pygtk. This is an issue with Archlinux because of the way python binaries are handled in this distribution. However, [...]]]></description>
			<content:encoded><![CDATA[<p>
If you&#8217;ve tried to install dropbox-nautilus from the source found in the <a href=http://www.dropbox.com onclick="pageTracker._trackPageview('/outgoing/www.dropbox.com?referer=');">Dropbox</a> website, you&#8217;ll find that you can&#8217;t successfully complete the ./configure step of the package due to an error of the script not finding pygtk. This is an issue with Archlinux because of the way python binaries are handled in this distribution. However, you can use the <a href="http://aur.archlinux.org" onclick="pageTracker._trackPageview('/outgoing/aur.archlinux.org?referer=');">AUR</a> packages to install dropbox and its integration with Nautilus thank to the people that tweaked the scripts to work with Arch.
</p>
<p>
The first step you have to take is download the AUR packages. You&#8217;ll need to download both <a href="http://aur.archlinux.org/packages.php?ID=23363" onclick="pageTracker._trackPageview('/outgoing/aur.archlinux.org/packages.php?ID=23363&amp;referer=');">dropbox</a> and <a href="http://aur.archlinux.org/packages.php?ID=19615" onclick="pageTracker._trackPageview('/outgoing/aur.archlinux.org/packages.php?ID=19615&amp;referer=');">nautilus-dropbox</a>. Save both .tar.gz files at you preferred location and uncompress them using this command:
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz <span style="color: #000000; font-weight: bold;">&lt;</span>filename.tar.gz<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
Obviously, change <filename.tar.gz> with the filenames you have downloaded. Each tar command will create a folder. Go to the dropbox folder and run this package:
</p>
<pre lang=bash">
makepkg -s
</pre>
<p>
This will build a package and install the required dependencies while doing it if needed (it will ask for your root password if you&#8217;re doing this without being root). If everything went ok, you&#8217;ll find a file with the extension .xy in the folder you&#8217;re in. This is what you need to install, using our beloved pacman (use <em>sudo</em> if you&#8217;re not root):
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pacman <span style="color: #660033;">-U</span> <span style="color: #000000; font-weight: bold;">&lt;</span>filename.xy<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
This will install dropbox. After this, do the same for the other package: nautilus-dropbox. <em>makepkg -s</em>, <em>pacman -U &lt;filaneme.xy&gt;</em> and you&#8217;re done, you have Dropbox integrated with Nautilus. Just start Dropbox from your <em>Applications</em> menu and enjoy the service!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fthinkingeek.com%2F2011%2F02%2F18%2Finstalling-dropbox-and-dropbox-nautilus-in-archlinux%2F&amp;title=Installing%20dropbox%20and%20dropbox-nautilus%20in%20ArchLinux" id="wpa2a_4" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save_url=http_3A_2F_2Fthinkingeek.com_2F2011_2F02_2F18_2Finstalling-dropbox-and-dropbox-nautilus-in-archlinux_2F_amp_title=Installing_20dropbox_20and_20dropbox-nautilus_20in_20ArchLinux?referer=');"><img src="http://thinkingeek.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://thinkingeek.com/2011/02/18/installing-dropbox-and-dropbox-nautilus-in-archlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 7.04, Mac OS X and Parallels howto</title>
		<link>http://thinkingeek.com/2007/06/30/ubuntu-704-mac-os-x-and-parallels-howto/</link>
		<comments>http://thinkingeek.com/2007/06/30/ubuntu-704-mac-os-x-and-parallels-howto/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 13:20:51 +0000</pubDate>
		<dc:creator>brafales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac os]]></category>
		<category><![CDATA[parallels]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://thinkingeek.com/?p=3</guid>
		<description><![CDATA[The virtualization world is not only for Windows and its name is not only VMWare. Specially since the migration of Apple&#8217;s Macs to the Intel x86 platform, that kind of software has seen in the Cupertino computers a new and fresh market to exploit. And one of the software pieces who has built one of [...]]]></description>
			<content:encoded><![CDATA[<p>The virtualization world is not only for Windows and its name is not only <a href="http://www.vmware.com/" onclick="pageTracker._trackPageview('/outgoing/www.vmware.com/?referer=');">VMWare</a>. Specially since the migration of Apple&#8217;s Macs to the Intel x86 platform, that kind of software has seen in the Cupertino computers a new and fresh market to exploit. And one of the software pieces who has built one of the best virtuaization products for the Macs has been <a href="http://www.parallels.com/" onclick="pageTracker._trackPageview('/outgoing/www.parallels.com/?referer=');">Parallels Desktop</a>.</p>
<p>Altough the Windows virtualization offered by Parallels is pretty nice (I&#8217;m still impressed of the Coherence Mode and I can&#8217;t wait to test the new 3D support features of the last version), it has also support for other Operating Systems such as Linux. And because Ubuntu is at this moment one of the most popular Linux distributions, a lot of people (including myself) have tried to install it in a virtual image on a Mac.</p>
<p>Unfortunately, the latest <a href="http://www.ubuntu.com/" onclick="pageTracker._trackPageview('/outgoing/www.ubuntu.com/?referer=');">Ubuntu </a>version, 7.04, aka Feisty Fawn, seems to have some problems installing on Parallels. The most important one is that the Live and installer CD will simply not boot correctly, showing a &#8220;Black Screen of Death&#8221; when loading the frame buffered splash screen.</p>
<p>But don&#8217;t worry, everything should be fine if you choose <em>Solaris </em>and <em>Other Solaris</em> as a OS Type and OS Version respectively when creating the virtual machine. Simply boot the Live CD, install the Linux distribution and when it asks you to reboot, shut down, change the virtual machine type to Linux and &#8220;Other 2.6 Linux&#8221; and it&#8217;s done! Enjoy the wonderful open source operating system on your Mac OS!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fthinkingeek.com%2F2007%2F06%2F30%2Fubuntu-704-mac-os-x-and-parallels-howto%2F&amp;title=Ubuntu%207.04%2C%20Mac%20OS%20X%20and%20Parallels%20howto" id="wpa2a_6" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save_url=http_3A_2F_2Fthinkingeek.com_2F2007_2F06_2F30_2Fubuntu-704-mac-os-x-and-parallels-howto_2F_amp_title=Ubuntu_207.04_2C_20Mac_20OS_20X_20and_20Parallels_20howto?referer=');"><img src="http://thinkingeek.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://thinkingeek.com/2007/06/30/ubuntu-704-mac-os-x-and-parallels-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create your own local domain with DHCP and BIND</title>
		<link>http://thinkingeek.com/2007/06/19/create-your-own-local-domain-with-dhcp-and-bind/</link>
		<comments>http://thinkingeek.com/2007/06/19/create-your-own-local-domain-with-dhcp-and-bind/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 17:47:25 +0000</pubDate>
		<dc:creator>brafales</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://thinkingeek.com/?p=37</guid>
		<description><![CDATA[If you begin to have a lot of computers at home, or even you manage a little LAN on an office, it may come in handy to have a little domain configured. Having a domain configured has some advantages, including easy machine naming and name resolution of those machines. We&#8217;ll explain here how to setup [...]]]></description>
			<content:encoded><![CDATA[<p>If you begin to have a lot of computers at home, or even you manage a little LAN on an office, it may come in handy to have a little domain configured. Having a domain configured has some advantages, including easy machine naming and name resolution of those machines. We&#8217;ll explain here how to setup a little domain with a linux machine and an opensource DHCP and DNS servers.</p>
<p>For this to work you&#8217;ll need:</p>
<ul>
<li>A linux box.</li>
<li><a href="http://www.isc.org/index.pl?/sw/dhcp/" onclick="pageTracker._trackPageview('/outgoing/www.isc.org/index.pl?/sw/dhcp/&amp;referer=');">ISC DHCP Server</a>.</li>
<li><a href="http://www.isc.org/index.pl?/sw/bind/" onclick="pageTracker._trackPageview('/outgoing/www.isc.org/index.pl?/sw/bind/&amp;referer=');">ISC Bind DNS Server</a>.</li>
</ul>
<p><span id="more-37"></span>
</p>
<p>Having a custom DHCP server will allow you to have more control over the IP leases you have in your network. One nice feature that most of the low cost DSL/Cable routers don&#8217;t provide are static IP mappings for specific machines via it&#8217;s MAC Ethernet address. Of course you could simply configure the IPs of your computers statically, but it&#8217;s always more confortable to simply check the &#8220;get everything network related automagically&#8221; when you are configuring your computers. And having some specific computers an static IP address will be very useful later, when we set up the DNS, so we will be able to have our computers friendly names such as &#8220;router&#8221;, &#8220;dad&#8221;, &#8220;xbox360&#8243; or &#8220;mediacenter&#8221;. Another interesting advantage on having certain computers on certain IP addresses is that we can configure certain ports to be open for specific machines without having to worry on what IP will it have when the lease expires or the computers reboots.</p>
<p>Having a custom DNS will serve two purposes. First of all, as an internet DNS server, which will come in handy since we&#8217;ll be querying the DNS root servers directly, avoiding the risk of our ISP DNS to shut down and leaving us without name resolution. And secondly, will allow us to resolve names in our custom domain, so we can connect to our dad&#8217;s comp or our Xbox 360 simply typing &#8220;dad&#8221; or &#8220;xbox360&#8243; as the network name of the device.</p>
<p>First of all, we&#8217;ll start configuring the DHCP server. Use your preferred method to install ISC DHCP Server in your current distribution. When you have it installed, we&#8217;ll create our custom IP leasing schema. We will use the subnet 192.168.1.0/24 (refer to a networking manual if you have trouble finding out what those numbers mean). For simplicity&#8217;s sake, let&#8217;s suppose we have 4 devices we want to configure in our LAN. Finally, we will use &#8220;mydomain&#8221; as a domain name.</p>
<ul>
<li>Our internet router, will have the IP address 192.168.1.1 (remember to turn off the DHCP Server from this router or you&#8217;ll end up with a nasty broadcast conflict).</li>
<li>Our server, will have the IP address 192.168.1.2 and it&#8217;s name will be &#8220;server.mydomain&#8221;.</li>
<li>Our computer, will have the IP address 192.168.1.3 and it&#8217;s name will be &#8220;uber.mydomain&#8221;.</li>
<li>Our dad&#8217;s computer, will have the IP address 192.168.1.4 and it&#8217;s name will be &#8220;dad.mydomain&#8221;.</li>
<li>An Xbox 360 computer, will have the IP address 192.168.1.5 and it&#8217;s name will be &#8220;xbox360.mydomain&#8221;.</li>
</ul>
<p>We&#8217;ll reserve those 5 initial addresses and some more for static purposes, let&#8217;s say from 192.168.1.1 to 192.168.1.20, because we may add new machines in the future. We&#8217;ll want other computers who want to connect (such as laptops or another gadgets like PSPs or Nintendo DSs) have a random IP dynamically assigned starting from 192.168.1.21 until 192.168.1.254. This is what we have to put on our &#8220;/etc/dhcp3/dhcpd.conf&#8221; configuration file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.2;
option domain-name &quot;mydomain&quot;;
# mydomain
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.21 192.168.1.254;
        }</pre></div></div>

<p>
This lines will tell the server some default options like the lease time, but more importantly, the gateway, dns server and network mask and broadcast address. The subnet clause will tell the server the range of IPs it has to lease for the network we want to set up.</p>
<p>The next step is to set up the fixed IP hosts. We will have to add a clause like this one for every one of them:
</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">host uber {
   hardware ethernet 00:00:00:00:00:00;
   fixed-address 192.168.1.3;
}</pre></div></div>

<p>Note the two lines. &#8220;hardware ethernet&#8221; must containt the MAC address of the network card of the computer you want to configure, and &#8220;fixed address&#8221; must contain the IP address you want to assign to that computer. Consult your OS networking documentation on how to obtain the MAC address of your NIC if you don&#8217;t know how to do it.</p>
<p>This is all you need to setup your DHCP server.</p>
<p>Let&#8217;s see now how to configure the DNS service. I&#8217;m not gonna tell you the specifics on how to setup bind to resolve internet addresses. It should ship configured to do so by default. If it does not, Google it to find the standard setup. What I&#8217;m gonna show you here is how to set it up to resolve names in our domain &#8220;mydomain&#8221;. What wee need to tell our bind server are three things:</p>
<ul>
<li>That he has to resolve the names in the &#8220;mydomain&#8221; domain.</li>
<li>Where to find the name &#8211; address resolution.</li>
<li>Where to find the address &#8211; name resolution.</li>
</ul>
<p>Let&#8217;s start with the latter options. Use your favourite text editor to edit a file named &#8220;/etc/bind/db.mydomain&#8221; and type this in it: </p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$TTL 3D
@       IN      SOA     server.mydomain. ns2.mydomain. (
                        199802151       ; serial, todays date + todays serial #
                        8H              ; refresh, seconds
                        2H              ; retry, seconds
                        4W              ; expire, seconds
                        1D )            ; minimum, seconds
mydomain.        IN NS      server.mydomain.              ; Inet Address of name server
&nbsp;
localhost.mydomain. IN A 127.0.0.1
server.mydomain. IN A 192.168.1.2
uber.mydomain. IN A 192.168.1.3
dad.mydomain. IN A 192.168.1.4
xbox360.mydomain. IN A 192.168.1.5</pre></div></div>

<p>The file is pretty self explanatory. We&#8217;re telling our server the mapping and some parameters like refresh time of the resolutions.</p>
<p>If we want reverse dns, we have to tell the server the reverse map. You should keep those two files in sync whenever you modify one of them. Again, edit a file named &#8220;/etc/bind/db.192.168.1&#8243; and type in those lines: </p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$TTL 3D
@               IN      SOA     ns.mydomain. hostmaster.mydomain. (
                199802151       ; Serial
                8H      ; Refresh
                2H      ; Retry
                4W      ; Expire
                1D)     ; Minimum TTL
        NS      ns.mydomain.
2 PTR server.mydomain.
3 PTR uber.mydomain.
4 PTR dad.mydomain.
5 PTR xbox360.mydomain.</pre></div></div>

<p>Now we have to tell our server that he has to resolve the addresses from those domains using the files we just created. Edit your bind configuration file (typically &#8220;/etc/bind/named.conf&#8221;) and add those two zones: </p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">zone &quot;mydomain&quot; {
        type master;
        file &quot;/etc/bind/db.mydomain&quot;;
        allow-query { 192.168.1.0/24; };
};
&nbsp;
zone &quot;1.168.192.in-addr.arpa&quot; {
        type master;
        file &quot;/etc/bind/db.192.168.1&quot;;
        allow-query { 192.168.1.0/24; };
};</pre></div></div>

<p>And voilà, you&#8217;re done! Now you have the computers in your LAN in a proper domain, with the IP addresses and names you want and en easy way to connect to them by simply using its names.</p>
<p>Don&#8217;t forget that for everything to work you have to configure your computers to use DHCP and that they must resolve the names in the &#8220;mydomain&#8221; domain. This is done in different ways depending on your OS. In Linux you must use the &#8220;search&#8221; option in the &#8220;/etc/resolv.conf&#8221; file (which isn&#8217;t really needed because we specified that in our DHCP server). In Mac OS this option is configured in the NIC setup, and in Windows it&#8217;s done under the System Preferences.</p>
<p>Thanks to Roger Ferrer on helping me with the understanding of Bind!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fthinkingeek.com%2F2007%2F06%2F19%2Fcreate-your-own-local-domain-with-dhcp-and-bind%2F&amp;title=Create%20your%20own%20local%20domain%20with%20DHCP%20and%20BIND" id="wpa2a_8" onclick="pageTracker._trackPageview('/outgoing/www.addtoany.com/share_save_url=http_3A_2F_2Fthinkingeek.com_2F2007_2F06_2F19_2Fcreate-your-own-local-domain-with-dhcp-and-bind_2F_amp_title=Create_20your_20own_20local_20domain_20with_20DHCP_20and_20BIND?referer=');"><img src="http://thinkingeek.com/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://thinkingeek.com/2007/06/19/create-your-own-local-domain-with-dhcp-and-bind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

