Dwm status bar and sys tray

Since last 2 years I have been using Manjaro KDE but Manjaro is eating my RAM.
I decided to move to Archlabs and I am using Plasma versio and very satisfied it it.
However, I would like to start using Dwm.
But, there is no status bar and nosystray in the bar as in the otherArchLabs versions (bspwm and i3).
I am a complete nube in programming and it has been dificult for me to include the status bar and the systray.
Can you help me with this by disclosing to me a complete guide on how to do it?
You can explian to me like you would do with a 2 years boy, ok?
Thank you in advance.
Stay Safe

Hi There.

You will need to patch this to your dwm add systray


Thank you very much for the info.
I have already accessed that link but how do I do that?
I do not know how to patch it.
As I mentioned before I am a nube on this. I am not lazy to study on how to do it but my knowledge about this is Zero.
Thank you

1 Like

Okay. So there are commands to use to auto-patch but I find once you have added a couple of patches the auto-patching method goes out the window.

Basically what I do is I have a separate folder I build dwm in when adding patches. This way if any issues crop up it doesn’t effect my main build.

Manual patching can be tedious but it seems to be the most effective for me.

What I do is open the patch in an editor (vim, emacs, Subime, Geany, whatever one you use). It will tell you what files from dwm you will need to edit or create. For example using the systray patch you will need to edit config.def.h and dwm.c you will know this because it is stated in the .diff fiile:

--- a/config.def.h
+++ b/config.def.h
--- a/dwm.c
+++ b/dwm.c

You will see what needs to be added to each relevant config from the .diff as it will have a + symbol next to it, what you need to remove will have a - symbol.

I normally find the line I need to edit in the folder by copying the line from the .diff that isn’t changing then moving over to the relevant file (config.def.h or dwm.c or whatever) finding that line, swapping back to the .diff, copying and then pasting the change required into the config (config.def.h or dwm.c, using the systray patch as an example of the files to be edited, other patches will require either a new file to be added or even more files to be edited such as makefile and dwm.1).

For example here I look would for the enum { NetSupported, NetWMName, NetWMState, NetWMCheck, line in the file to be edited, then copy and paste the + NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, line and paste it after the aforementioned line

 /* enums */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+       NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
        NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
        ClkClientWin, ClkRootWin, ClkLast }; /* clicks */

Once you have finished patching, cd into your folder you are building your custom dwm build in and run sudo make clean install.
If it is successful it won’t throw any errors but if you have made a mistake or the patch conflicts with another one you will get an error similar to this:

In file included from dwm.c:348:
config.h:237:52: error: ‘togglescratch’ undeclared here (not in a function)
  237 |         { MODKEY,                       XK_grave,  togglescratch,           {.v = scratchpadcmd } },
      |                                                    ^~~~~~~~~~~~~
dwm.c:361:21: warning: ‘scratchtag’ defined but not used [-Wunused-variable]
  361 | static unsigned int scratchtag = 1 << LENGTH(tags);
      |                     ^~~~~~~~~~
make: *** [Makefile:18: dwm.o] Error 1

Here I tried building an incomplete dwm build, I hadn’t finished patching the scratchpads patch.

Here is a successful build:

rm -f dwm drw.o dwm.o util.o dwm-6.2.tar.gz
dwm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION="6.2" -DXINERAMA
LDFLAGS  = -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lXrender -lmpdclient
CC       = cc
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"6.2\" -DXINERAMA drw.c
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"6.2\" -DXINERAMA dwm.c
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"6.2\" -DXINERAMA util.c
cc -o dwm drw.o dwm.o util.o -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lXrender -lmpdclient
mkdir -p /usr/local/bin
cp -f dwm /usr/local/bin
chmod 755 /usr/local/bin/dwm
mkdir -p /usr/local/share/man/man1
sed "s/VERSION/6.2/g" < dwm.1 > /usr/local/share/man/man1/dwm.1
chmod 644 /usr/local/share/man/man1/dwm.1

Lob out and back in to view the changes.

If you want to try my build, there is a link to my repo in my signature, just be aware it is built for dual screens and HiDPi screens and there are certain fonts and personal scripts required. Hope this all made sense.

Start by reading the ArchWiki page for dwm

Since you want a system tray, you will need to patch the dwm source code then compile it. This is all done from the terminal command line, so open a terminal and:

  1. Make yourself a build directory and cd into it.
mkdir build && cd build
  1. Now that you’re in your build directory, use git to clone the dwm source:
git clone https://git.suckless.org/dwm

That will create the ~/build/dwm directory and clone the dwm sources into it. The config.def.h and dwm.c file @Dobbie03 references will be in there.

  1. Get and apply the patch . Get the latest system tray patch from the suckless site. Download the patch file to ~/build/dwm

Once you download the patch, you need to apply it. @Dobbie03 post has the directions to manually patch and then compile dwm.


You can use conky for a status bar - the ArchWiki has instructions for doing that, or you can try something else. I use slstatus for system information. But you’ll need to clone the sources and compile it. Conky is the better option if you’re new to dwm.

1 Like

My examples were assuming @neldu311 had already cloned the repo.

1 Like

Maybe polybar on dwm is easier? You need GitHub - nixenos/polybar-dwm-module: A dwm module for polybar though.

1 Like

It’s a fucker to patch plus that ipc patch is FUCKING huge, though I am looking at it froma manual patching perspective.

1 Like

FWIW I have written “too much” about many things. However, this dwm stuff may be of some use to you. If not, oh well.