DWM, one of the most efficient window managers

I've been using very lightweight window managers for a few years now. I started with flux box, then OpenBox when installing the distribution Crunchbang, from this I went to xmonad and finally, DWM, the window manager on which Xmonad is based. In fact, Xmonad is a DWM clone written in Haskell instead of C.

That said, I think I've tried quite a few managers to come to the conclusion (personal, of course) that DWM is undoubtedly the best of all, especially in terms of efficiency and customizability. In this article I will try to explain step by step how to install it and make a short introduction to its use.

Installation

In this case, DWM will not be installed in the conventional way via apt, we will directly clone your repository, for this:

$git clone http://git.suckless.org/dwm

Once downloaded, we get into the directory. The most important file in terms of configuration is config.def.h. All modifications will be made in said file. Be careful, this file is the one that comes by default, in order to compile it is necessary that the file is called config.h. Once we run make, he will take care of creating it if it doesn't exist.

Before continuing, you might want to install a few tools, such as dmenu, which will allow to launch any program. For this we execute:

sudo apt-get install suckless-tools

Changes to make before compiling

Before compiling, it would be ideal to at least change which terminal we want DWM to execute when pressing ALT + Shift + Enter. For this we modify in the file config.def.h, (or config.h if you have already created the copy) the following line:

static const char * termcmd [] = {"st", NULL};

By your preferred terminal, in my case Terminator:

static const char * termcmd [] = {"terminator", NULL};

There is still something else to do before installing. Create a DWM session that allows us to execute it when entering the system. We will need a file that we will call dwm.desktop and we will place in / usr / share / xsessions, the content should be as follows:

[Desktop Entry] Encoding = UTF-8 Name = Dwm-personalized Comment = Dynamic window manager Exec = dwm-personalized Icon = dwm.png Type = XSession

In turn, we will create a script that will be executed when entering this session, called dwm-personalized to which we will give execution permissions and its content will be the execution of all the programs that we want to execute at startup. Mine for example is:

#! / bin / bash # setting keyboard layout /usr/share/X11/xkb/rules/base.lst setxkbmap us intl xset + fp / usr / share / fonts / local xset fp rehash nm-applet & parcellite & xfce4-volumed & #Set status bar & start DWM dwmstatus & exec dwm

The script should be saved in / usr / bin with execute permissions:

chmod + x dwm-personalized

Build and install

Now, inside the directory where DWM is located, we compile and install:

sudo make clean install

After this, we exit the current window manager and enter with DWM.

User's guide

Once inside, with Alt + Shitf + Enter the terminal defined above will be executed. The basic commands are

- [Shift] + [Alt] + [Enter] - Launch the terminal
- [Alt] + [p] - Launch dmenu
- [Alt] + number from 1 to 9 - move between the different labels (or desktops)
- [Shift] + [Alt] + number - Move the window to the indicated number
- [Alt] + [Shift] + c - Close the current window

There are 3 types of layout by default, tiled ([Alt] + t), Monocle ([Alt] + m) that shows a window full screen, and we can navigate between them with [Alt] + j or [Alt] + k, and finally Floating, to move and resize the windows to our liking.

All keyboard shortcuts are in the file config.def.h, and that is where we will declare the new ones.

If you prefer to use the windows key instead of [Alt], just modify the line

#define MODKEY Mod1Mask

by

#define MODKEY Mod4Mask

and recompile.

Modifying DWM at will

There are many patches that can be applied to DWM on its official website (http://dwm.suckless.org/patches/). However, one of the most striking, coloring the status bar, is not available for the latest version (6.1). I have tried writing one and it currently works quite well. Is found in github.com/someone91/myDWM and it's as easy to run as download and type:

git apply dwm-6.1-simplestatuscolor.diff

To use it you need to use dwmstatus and format the state as follows.

The patch has 7 colors, to indicate the color to use, you must write the character \ xCL at the end of the text to be colored, where CL is a digit from 01 to 07. For example, using the first three colors:

status = smprintf ("L:% s \ x01 A:% s \ x02 U:% s% s \ x03", avgs, tmar, tmutc, tmbln);

It will color L:% s with color 1, L:% s with color 2, and U:% s% s with color 3.

If you want to know the programming details about the patch you can consult this article.

Final comments

I hope you liked the article and are encouraged to try this type of window manager. Since I discovered them, I have not used the conventional managers again, and I do not miss them. I leave you a screenshot:

Screenshot - 290714 - 13-11-28


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   nobody said

    testing comment from tor 🙂

    1.    pandev92 said

      And this, what has to do with the article?

  2.   Bond said

    Regarding RAM consumption, how is it compared to the one that comes by default in xfce?

    1.    Alexander Mayor said

      Good,

      I've done the measurements with the basics running, the battery applet, and the network connections. Here the results:

      DWM: 140 MiB of 4Gib
      XFCE: 279 MiB of Gib

      1.    Bond said

        Thank you very much, I'll install it then: D, I was just looking to reduce ram consumption.

      2.    Alexander Mayor said

        I hope it does not disappoint you

    2.    dhunter said

      Low ram consumption without losing eyecandy? ===> IceWm + tint2 + wbar

  3.   bmacf said

    I'll try to test it when going on vacation ... I've always been curious about WMs, but I'm too used to DEs ... And all the hassle of configuring from 0 is also something that seems a bit tedious to me, but I cured that after installing Arch… xD

    1.    Alexander Mayor said

      Yes it is true that at first it is a bit tedious, but once you get used to it ... it will be difficult to go back to the ED. 🙂

  4.   eliotime3000 said

    Awesome Plz!

    1.    desikoder said

      I was in awesome for a while, but I was not too convinced and I returned to my dear and faithful openbox, of course, configured from 0. By configuring from 0 I mean that instead of the openbox configuration xml that comes by default in debian with the openbox package, I have rewritten it almost from scratch, declaring in detail all the functions, for example, that when pressing alt + f4 or when hitting the window's closing blade, which borders allow dragging the window and which ones to resize it (I in my case I have the bottom and right edges to resize, the top and left edges to drag), and many more details. Also the window theme, although I'm thinking of giving it a new look. Anyway, it has a lot of work, in fact I have been saving my openbox configuration for some years, it is something that I appreciate a lot and that I do backup.

      Greetings!

  5.   BlackSheepX said

    Would it be enough to change apt-get to pacman in installation commands and the modifications would be the same to use it in Arch?

    1.    Alexander Mayor said

      I've never used Arch, but I guess so. Since DWM is installed from repository and the only necessary package, if you want to use dmenu, is suckless-tools.

    2.    Wada said

      No, the truth is not the same in Archlinux there is no such suckless-tools package when I install it, download dwm, and dmenu, compiling them from 0, you can also use ABS which is more recommended, than using pacman.

      There is DWM in pacman packages but I don't recommend that you install it from there, so you can compile and modify it to your liking. 🙂

      1.    eliotime3000 said

        And how about Awesome?

      2.    Wada said

        Awesome I do not change it Elio, it consumes me when starting only 126MB it is modular and programmed in LUA, so I do not need to be compiling for each configuration made, and let me say that it is 126MB for Slim there was a time that I used login by TTY / Bash and at booting used about 80MB.

      3.    eliotime3000 said

        Well next time I'll have to learn how to configure Awesome with gambling and sluts (#OkNo), and thus not have to suffer more bugs or glitches from desktop environments (so far XFCE, KDE 4.8 and GNOME 2 I have not been disappointed).

    3.    Alexander Mayor said
  6.   gonzalemd said

    Thanks for the note, I'll try it once. Regards.

  7.   Dark purple said

    Missing?
    Don't miss the spelling, please.

    1.    Alexander Mayor said

      I know, sorry. But by the time I realized I could no longer edit the article. :-(. Could anyone correct it?

      1.    Alexander Mayor said

        But for * and if someone could *. (The things of writing from the mobile and not being able to edit .. XD)

  8.   illukki said

    Good tuto. Sooner rather than later I will arrive at these WMs but you have to dedicate the necessary time to learn to leave it at ease.
    Greetings.

  9.   debish said

    I've been through quite a few too, and I don't even dare say which one is "best" for me. Of the non-tiling I especially like fluxbox and openbox and the tiling ones, although it is harder for me to choose because each one is a fucking wonderful world, I would say i3 and dwm. I like them better, which does not mean that they are better or worse ...

    1.    Jesus Ballesteros said

      Exactly, it's a matter of taste. I personally do not like the WM tiling, unless you are a programmer of course, for other things they make me unproductive or perhaps it is I who does not know how to use them but from there to say that one is better than another we would return to the typical flamewars from when the fight was between KDE and Gnome 😀

      1.    Bond said

        What is the difference between tiling and no tiling? Thanks in advance.

      2.    Jesus Ballesteros said

        Hi Bonus,

        Here is the explanation of the different types of WM.

        https://wiki.archlinux.org/index.php/Window_Manager_%28Espa%C3%B1ol%29

        This is an example of "Awesome" which is a tiling type.

        https://www.youtube.com/watch?v=4mMb7qXwhuU

        A greeting.

  10.   m said

    dwm is a ... sorry, two ball pains: to change anything you have to touch the code and recompile - always assuming you know C.

    SpectrWM is the bomb daddy!

  11.   johnfgs said

    It's interesting but I can't see the appeal of these esoteric window managers. Recompiling every time you want to change some behavior is good ... a bit too much. I understand that there are people somewhat obsessive with memory consumption, but basically having to reinvent the wheel every time ... it is impractical, and if the issue is low memory consumption, well ... it seems to me that it is like cutting your legs and saying «I lost 30 kilos of weight ».

    Other than that, it is still interesting if you are interested in learning how a WM works, especially if it is NetWM compliant.

    1.    Alexander Mayor said

      It is a matter of taste. Although really recompiling is only executing one line (sudo make clean install) AND no restart is necessary. There is a patch out there that allows you to re-launch DWM by pressing MODKEY + q

  12.   oscar meza said

    Hi, how is DWM to Fluxbox in terms of hardware resource consumption?