DWM [Solved] Setting up DWM in FreeBSD

Hi, I’m brand new to both FreeBSD and DWM.
I’ve tried for a few days now to set up DWM but I can’t seem to get it figured out. I’ve installed xorg and I can get xterm to open, but I can’t get dwm to do anything as it outputs a display error (cannot open display) every time I try to launch it.

Do most Linux guides also apply to using dwm in FreeBSD?
As I’ve said, I’m new to both BSD and DWM and I’m not sure what guides I can reliably follow.

Thanks ahead of time, sorry of this is a redundant thread.
 
I failed to mention this is the post, but I’m running FreeBSD13 in virtualbox, not on hardware.
 
dwm is a wm. Please watch some videos about de and wm to understand more about them.
Xterm is a terminal, like an app. You can open it after loging in. But you cannot change DE or WM after loging in.
You can specify to always login to a specific wm or de after boot in xinitrc.
And yes, most guides about linux can be used on bsd but you have to be careful, for eg bsd filesystem is different, so if in linux a config is in /etc/vim/config, in bsd it can be /usr/local/vim.conf (just an example).
Also flags in some commands are also diff in linux and bsd.
 
1.) Don't use the package (or port) to install x11-wm/dwm. Why, simple you can't patch that, or at least in the case of the port you can but you need to know how to do that, which is not your case.
2. Install dwm using sources (suckless.org).
e.g.:
Code:
$ git clone https://git.suckless.org/dwm
$ cd dwm
3 . Edit config.mk so you can build dwm on FreeBSD, more precisely the following lines:
Code:
X11INC = /usr/X11R6/include                      ->          X11INC = /usr/local/include
X11LIB = /usr/X11R6/lib                          ->          X11LIB = /usr/local/lib
FREETYPEINC = /usr/include/freetype2             ->          FREETYPEINC = /usr/local/include/freetype2
4. Now you can config/patch and install dwm on your system.
Code:
e.g.
$ vim config.def.h
$ patch -p1 < dwm-autostart-20210120-cb3f58a.diff
sudo make clean install
 
I find that using the source on FreeBSD is more complicated than just getting the config.h from make extract, editing it, putting any patches in /usr/ports/x11-wm/dwm/files/ and using the port to install it.
I have found--don't remember when, it was awhile ago, and I've used the port since, when the source code, plus patches, gave me problems on FreeBSD, might have been something in there that expected a Linux path, but honestly, I don't remember at all.

Anyway, there's a message that quickly goes off the screen, but if, for example, you put your custom config.h in $HOME/dwm/config.h you can install the port with
make DWM_CONF='/home/<username>/dwm/config.h' install

I have a page which needs updating--the section on the move-resize patch is way out of date, but does have some good links, including one to a debian forums article about configuring config.h at

I see Minbari covers fixing any Linux-isms, fixing config.mk, but for me, using the port avoids all that.
 
dwm is a wm. Please watch some videos about de and wm to understand more about them.
Xterm is a terminal, like an app. You can open it after loging in. But you cannot change DE or WM after loging in.
You can specify to always login to a specific wm or de after boot in xinitrc.
And yes, most guides about linux can be used on bsd but you have to be careful, for eg bsd filesystem is different, so if in linux a config is in /etc/vim/config, in bsd it can be /usr/local/vim.conf (just an example).
Also flags in some commands are also diff in linux and bsd.
Thanks for the information, I’ll keep this in mind.
 
OP: so X is running successfully? What window manager are you running now to be able to see an xterm? I think the default is x11-wm/twm. How are you running X, startx?

Xterm doesn't even always come up, but when it did I believe I used xterm and it started. Forgive me if I give some conflicting information, as I said I’m new to BSD so I keep getting lost. Also forgive any formatting errors in my comments if you would, I’m away from my computer now so I’m having to write this on my phone.
 
1.) Don't use the package (or port) to install x11-wm/dwm. Why, simple you can't patch that, or at least in the case of the port you can but you need to know how to do that, which is not your case.
2. Install dwm using sources (suckless.org).
e.g.:
Code:
$ git clone https://git.suckless.org/dwm
$ cd dwm
3 . Edit config.mk so you can build dwm on FreeBSD, more precisely the following lines:
Code:
X11INC = /usr/X11R6/include                      ->          X11INC = /usr/local/include
X11LIB = /usr/X11R6/lib                          ->          X11LIB = /usr/local/lib
FREETYPEINC = /usr/include/freetype2             ->          FREETYPEINC = /usr/local/include/freetype2
4. Now you can config/patch and install dwm on your system.
Code:
e.g.
$ vim config.def.h
$ patch -p1 < dwm-autostart-20210120-cb3f58a.diff
sudo make clean install
Thanks Minbari, I’ll come back tonight and follow through on this.


I find that using the source on FreeBSD is more complicated than just getting the config.h from make extract, editing it, putting any patches in /usr/ports/x11-wm/dwm/files/ and using the port to install it.
I have found--don't remember when, it was awhile ago, and I've used the port since, when the source code, plus patches, gave me problems on FreeBSD, might have been something in there that expected a Linux path, but honestly, I don't remember at all.

Anyway, there's a message that quickly goes off the screen, but if, for example, you put your custom config.h in $HOME/dwm/config.h you can install the port with
make DWM_CONF='/home/<username>/dwm/config.h' install

I have a page which needs updating--the section on the move-resize patch is way out of date, but does have some good links, including one to a debian forums article about configuring config.h at

I see Minbari covers fixing any Linux-isms, fixing config.mk, but for me, using the port avoids all that.
noted, thanks for the information. I’ll read back over this once I’m back on my computer.


Once again everyone, apologies for my formatting and posting more comments than necessary. I’m on my phone right now and it’s being a pain.
 
I

I may not have X running properly after all. How would I troubleshoot and verify that I have it set up properly?
Sorry for the late reply, my schedule has been hectic. How do you start X? Via a display manager or via startx? If startx, are there error messages and if so, what are they?[/CMD]
 
Sorry for the late reply, my schedule has been hectic. How do you start X? Via a display manager or via startx? If startx, are there error messages and if so, what are they?[/CMD]
Well I'll be damned, this entire time I was going about things the wrong way and didn't have X running after all. startx did in fact work and Mate, which I also installed and tried to get working, launched right away. Thanks, I've been trying for weeks at this point to get a desktop working.
 

Attachments

  • FreeBSD13.PNG
    FreeBSD13.PNG
    47.4 KB · Views: 357
I'll be getting dwm set up once I have some spare time to get deepr into that, so thanks for the infirmation folks.
 
I'll add one more thing that I don't think I cover on my dwm page. In FreeBSD (probably in Linux as well) their default terminal is st, found in FreeBSD as pkg or port sterm, and it installs with dwm. It has reasonable defaults, black terminal with white background. If you want to change it, again, you have to edit its config.h file, though there is an option in the port, which I haven't tried, to allow settings to be handled from Xresources,.

I have also found that after making my customized installs of sterm and dwm, I have to lock both packages. Otherwise, when I check for pkg update, it wants to update them because the options have changed. (I also recommend, once you're satisfied with with both of them to do a pkg create so you have a package, with your defaults, of both st and dwm.

The st terminal's config.h isn't that hard to figure out, but if you decide to use and run into issues, post here. To change colors, you count, starting at 0, the list of terminal colors and replace defaultfg and defaultgb (and mousebg and mousefg) with the numbers of the terminal color that you want. For example, I have defaultfg as 15 meaning a white foreground.
 
Back
Top