%Beginners guide to wmii
%Copyright (C) 2005,2006 by Steffen Liebergeld

%This program is free software; you can redistribute it and/or
%modify it under the terms of the GNU General Public License
%as published by the Free Software Foundation; either version 2
%of the License, or (at your option) any later version.

%This program is distributed in the hope that it will be useful,
%but WITHOUT ANY WARRANTY; without even the implied warranty of
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%GNU General Public License for more details.

%You should have received a copy of the GNU General Public License
%along with this program; if not, write to the Free Software
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[left=3cm,top=2cm,right=2cm,bottom=3cm]{geometry}
\usepackage[a4paper,dvipdfm]{hyperref}
%\usepackage{ngerman}
\usepackage{times}
\newenvironment{itemize*}
  {\begin{itemize}
      \setlength{\itemsep}{0pt}
      \setlength{\parskip}{0pt}}
  {\end{itemize}}
\date{\today}
\author{Steffen Liebergeld}
\title{A beginners guide to wmii}
%\email{stepardo@gmail.com}

\begin{document}

\maketitle

\tableofcontents

\newpage

\section{What you need to know}

   \subsection{Wmii - the second generation of window manager improved}

      wmii is a lightweight window manager for the X Window System.  It
      provides a synthesis of conventional, tiled and tabbed window management
      based on layouts. Several roots of these window  management
      capabilities  have  been introduced by the Ion and LarsWM window man-
      agers.  Apart from this, it implements a socket-based fileserver, which
      is  accessed  to configure and interoperate with wmii. The idea behind
      this file-based approach is derived from the plan9 operating system and
      can be found in  the  Acme  programming environment.  wmii consists of
      the core window manager itself and several utilities, such as wmibar,
      wmifs, wmimenu, wmikeys, wmiplumb, wmir and wmiwarp.

   \subsection{What this document is all about}

      This document will teach you all you need to know to make a good living
      with wmii. You will learn how to configure and install wmii, and how to
      start using it. On the way you will get to know about certain design
      decisions. After reading this document, you will have fallen in love
      with wmii and be able to work with it much more effectively than you
      could before.

   \subsection{Who should read this document, or what you need to know before}

      This text is written for people, who already have lots of experience
      using Unix and who have quite good knowledge of some of the basic things
      in the X Window System. It is intended for people, who are eager to get
      to know new methods of interaction with their computer, and who
      are open minded with new technology. Maybe the term \emph{Hacker}
      describes the audience of this document best.

\section{Configuring and installing wmii}

   \subsection{Obtaining wmii}

      Wmii is to be licensed under the terms of the MIT/X Consortium License.
      That means, everybody is allowed to use, copy, modify, merge, publish,
      distribute, sublicense, and/or sell copies of the Software, and to
      permit persons to whom the Software is furnished to do so. Please note,
      that the authors provide the software "as is", without any warranty of
      any kind.
      
      Of course you can download the wmii sources from http://wmi.modprobe.de.
      For most major Linux distributions precompiled packages are available on
      the net already.

      If you would like to get the bleeding-edge, always freshest sources, you
      can easily check out the darcs repository.

   \subsection{Configuring}

      The wmii sources come with a file called "config.mk", which contains all
      the things one might want to adjust prior to compilation.

      The most important setting is the PREFIX, which tells where wmii is to
      be installed to. In this file you can also tell if wmii is to be built
      with cairo support. However cairo seems to be pretty unstable, so you
      are not encouraged to use it. You won't need it anyways.

   \subsection{Install}

      After you have configured wmii, you just have to issue \texttt{make} to
      built wmii.

      Now you will be able to install wmii as superuser using the \emph{make
      install} command.

      After installation you should copy the files from PREFIX/etc/wmii to a
      local  directory \emph{.wmii}.

      Note that PREFIX is \emph{/usr/local/} in the default install.

      To make wmii your default window manager, you add can write the
      following lines into your \emph{~/.xinit}( or \emph{~/.xsession} if you
      run a display manager like xdm):

      \begin{verbatim}
         #!/bin/sh
         exec wmii
      \end{verbatim}

   \subsection{Make it fit your needs}

      The directory \emph{~/.wmii} contains a set of files, which allow you to
      set your preferences for wmii.

      When wmii starts up, it executes a file called \emph{rc} in your
      \emph{~.wmii} directory. Please note, that this can be any executable,
      be it a shell script or a binary. The \emph{rc} program needs to know
      two parameters, \emph{start} and {stop}. On \emph{start} it has to set
      up the internal virtual filesystem of wmii.

      It is important for you to know that wmii uses a new concept of inter
      process communication for set up and usage. The basic approach is to use
      a filesystem-alike representation of the data. This idea is taken from
      the Plan9 operation system and its ACME-programming environment.

      Please note, that this internal filesystem will be mountable into a unix
      directory tree in the future, bringing you all the power of your
      standard shell tools to operate wmii.

      For this time, we should stick to the standard configuration, which is
      already very powerfull. I will teach you the basics of file manipulation
      and the filesystem later on.

\section{Terminology}

   \subsection{Pages}

      The whole visible area of your monitor is called a page. This is
      important for you to remember, because you will be able to apply layouts
      only to full pages later on.

   \subsection{Frames}

      Frames are exactly what the term \emph{suggests}: Frames are rectagular
      areas on pages, that contain X clients (e.g. an Xterm). In Wmii, default
      config, frames have a titlebar with a string identifying the contained
      client.

   \subsection{Clients}

      Any X program, or -so to say- any program that draws a window on a X
      Server is called a client. You will be able to do various manipulations
      on those clients later on. For now it is important for you to know that
      only one client at a time gets the users input. In our terminology this
      client is the "selected"\footnote{In the X Window System, this is called
      the \emph{focussed Client}} client.

   \subsection{Layout}

      A layout defines the behaviour of a page. It defines how frames are to
      be arranged on a page.

   \subsection{Actions}

      Actions are all the commands you can use to manipulate the window
      management. Maximizing a window or launching programs are actions, for
      example.

\section{Getting started}

   Before you fire up wmii for the first time, I would like you to write down
   some of the commands on a sheet of paper. Of course you could start right
   in without, but chances are that you will get stuck very soon. So here is
   the list:

   \begin{itemize*}
   \item MOD+Tab  = cycle frames
   \item MOD+shift+Tab = cycle nested frames (tabbed frames)
   \item MOD+ctrl+a  = open up actions menu
   \item MOD+ctrl+p  = open program menu
   \item MOD+t = open a Xterm
   \end{itemize*}

   I have to remind you, the \texttt{MOD} key is usually your \texttt{ALT}
   (left) key, but can be any other if you played with xmodmap.

   The shipped default layout is \emph{tiled}. So maybe it is a good start to
   open up a few Xterms now. You do this simply by pressing \texttt{MOD+t}. So
   after you opened 4 Xterms, you have quite a good playground for your first
   navigation experiments.

   Did you notice that wmii automatically placed and sized the new
   windows on creation? This is a feature and should help you to even further
   free your mind.

   Okay, type a few characters now. In one Xterm these characters should
   appear. This one is the \emph{selected} client. 

   How can you move the selection\footnote{or focus} now? It is very easy: you
   just press \texttt{MOD+Tab} and you will be pointed to the next Xterm. Do
   this a few times to get a feeling for it.

   \subsection{Trying different layouts}

      \emph{tiled} layout is already good and powerful, but wmii has some more
      layouts. It is now time to try them all. To do so, please press
      \texttt{MOD+shift+m} now. You will see that all the windows (frames) are now
      maximized on the page. Well, in fact you won't see that but only the one
      frame in front of you. This is what the \emph{max} layout is all about:
      maximized frames.

      Now press \texttt{MOD+Tab} again to cycle through the maximized frames.
      See how easy it is? In fact, the maximized layout is the one I use most
      since I like to use as much screenspace as possible. In fact it makes my
      life easier in one further aspect: it keeps all the other disturbances
      and dialogs out of my view so I can concentrate on my current work.

      But there are still other layouts for you to try. Press
      \texttt{MOD+shift+g} to enter \emph{grid} layout. Note that your Xterms
      now got aligned like those little rectangles on a chessboard. The
      philosophy with this is, that every frame should get as much screenspace
      as all the others. Note that you can now use \texttt{MOD+Tab} again to
      cycle through the frames. As you can see the titlebar of the focussed
      frame is highlighted in a different color than the others. This is
      useful when you are using nested frame - which you will learn about
      later on on.

      Let us just try another layout. Press \texttt{MOD+shift+f} to enter the
      \emph{float} layout. You will see that all the xterms are now floating
      without any order around on the page. This layout resemples the old
      fashioned window management of all the other boring window managers.

      You are free to change back to your favourite layout now.

      \begin{itemize*}
      \item \texttt{MOD+shift+m} = max layout
      \item \texttt{MOD+shift+t} = tiled layout
      \item \texttt{MOD+shift+g} = grid layout
      \item \texttt{MOD+shift+f} = float layout
      \end{itemize*}

      \subsection{Tabbed frames}

      Up to now we only had one client in one frame each. One could work with
      this already, but if you open up a lot of clients your workspace will
      get cluttered. To help avoid this wmii has a technique called
      \emph{tabbed frames}. It enables you to put more than one client in one
      frame. The clients are still using all the space in the frame each, but
      they will be arranged in tabs -just like in your favourite browser-. The
      tabs will be made visible in the titlebar of the frame, which is then
      tiled in as many parts, as you have clients in that frame, each part
      resempling one client.

      So far for the theory. Now lets try it out. Cycle to one xterm of your
      choice and press \texttt{MOD+u} to unlock the frame. All the clients you
      open up from now on will be placed in that frame. Press \texttt{MOD+t}
      to open up a Xterm. Note that this one is now in that old frame you are
      still in. The titlebar has split up in two. That ss good already, but how
      can you access the now hidden xterm? This is done with the nested
      cycling shortcut \texttt{MOD+shift+Tab}. Press it now to cycle trough
      the nested clients. If you press \texttt{MOD+Tab} again, you will see
      that you can still cycle through all the frames of the page just as you
      did before.

      Now cycle back to the frame with the two xterms and press
      \texttt{MOD+shift+u} to lock the frame. If you open up windows now, they
      will be put in new frames as usual.

      You have now learned two key concepts of wmii: \emph{locking} and
      \emph{unlocking} of frames.

   \section{Further concepts}

      \subsection{Zoom}

      Wmii has a feature called \emph{zoom}, which tries to rearrange the
      managed frames to give the focussed the most screenspace. This is the
      most helpful in tiled layout. You can invoke zoom by pressing
      \texttt{MOD+Enter}.

      \subsection{Virtual workspaces}

      You have only used one page now, but wmii offers you to have as muc of
      them as you want. You can create a new page by pressing
      \texttt{MOD+crtl+y}. Feel free to cycle through all the pages by
      pressing \texttt{MOD+l}.
      
      \subsection{Maximize}

      Sometimes you want to escape your cluttered page and see only one frame
      maximized. Well this is possible by pressing \texttt{MOD+m}. Wmii will
      create a virtual page and show only that one frame maximized on it. You
      can still get back to all the other pages with \texttt{MOD+l}. To get
      the maximized frame back into its previous place, just press
      \texttt{MOD+m} again.


      \subsection{How to move frames around}

      You may have asked yourself, how you could take an existing client and
      put it somewhere else, on another page or into another frame. In wmii
      this is done through detaching and attaching the frame. I will now giude
      you through that process:

      First of all, you will have to cycle to the frame you want to be placed
      somewhere else. Once you are there, press \texttt{MOD+d} to detach the client. You
      will see, that the client instantly disappears. Stay calm, the clients
      still exists in wmii's memory.

      You can now go to another frame, unlock it (\texttt{MOD+u}) and attach
      the detached client to it by issuing \texttt{MOD+a}. As you can see, the
      client is now part of that frame. You may now lock the frame again using
      \texttt{MOD+shift+u}. 

      You can also take a nested client and put it into a frame of its own.
      Just cycle to the client you want and detach it (\texttt{MOD+d}). Now
      make sure all frames are locked, so it won' get attached to any existing
      frame by accident and press \texttt{MOD+a} for attach. You will see,
      that the client is now on a frame of its own.
      
      \subsection{To wrap it up}
      
      \begin{itemize*}
      \item \texttt{MOD+Enter} = zoom a frame
      \item \texttt{MOD+ctrl+y} = create new page
      \item \texttt{MOD+l} = cycle pages
      \item \texttt{MOD+m} = maximize a client
      \item \texttt{MOD+u} = unlock a frame
      \item \texttt{MOD+shift+u} = lock a frame
      \item \texttt{MOD+d} = detach a client
      \item \texttt{MOD+a} = attach a previously detached client
      \end{itemize*}

      \subsection{Flashback}

      You might want to get a list of all the configured keystrokes of wmii.
      This can be easily generated using a tool called \texttt{wmirefcard}.
      
      Congratulations. You have now learned all you need to know to work with
      wmii. In the next chapter I'll give you some further insights into the
      configuration interface of wmii.

   \section{Looking under the hood}

      \subsection{Tools}

      Wmii consists of a number of tiny tools, each doing only one specific
      Task. Those tools are able to communicate with each other through a
      virtual filesystem. This design follows closely the main Unix rules -
      the \emph{Rule of Modularity} and the \emph{Rule of Composition}.
      
      You may want to read about it in \emph{The Art of Unix
      Programming}\footnote{The book \emph{The Art of Unix Programming} by Eric
      S Raymond can be read online at http://www.faqs.org/docs/artu/} by Eric S Raymond.

      \subsection{wmibar}

      Wmibar is a little tool that has the purpose of drawing a little bar
      with some labels on your screen.

      \subsection{wmimenu}

      Wmimenu is a tool that creates menus. It is highly configurable through
      its virtual filesystem, so that one can easily create his own
      menustructures and behaviours.

      \subsection{wmikeys}

      Wmikeys does all that has to do with keys. Basically it grabs the keys
      and executes actions. Again, this can be configured through its own
      filesystem.

      \subsection{wmifs}

      Wmifs has the purpose to bind all the different virtual filesystems of
      the wmii tools into one namespace, which acts like one virtual
      filesystem to the outside world. In other words, wmifs brings together
      all the interfaces of the wmii tools and let the look like one united
      interface.

      \subsection{wmir}

      Wmir is used to read and change the virtual filesystem exported by
      wmifs. You can use wmir to control virtually anything in wmii if only it
      has a representation in the wmifs.

\section{A tour through the ixpfs}

If you fire up \texttt{wmir read /} you will see the root node of the
ixpfs. You can then just browse through this filesystem just like you
would do in any other filesystem.

\section{Copyright notice}

Beginners guide to wmii
Copyright (C) 2006 by Steffen Liebergeld

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

\end{document}
