# Building the dwm window manager, st terminal, sltatus on Freebsd youtube tutorial



## NapoleonWils0n (Apr 22, 2020)

Hi All

I recently switched from i3wm and urxvt to the suckless dwm window manager and st terminal

So i decided to make a youtube video on how to build dwm, st and slstatus on Freebsd and linux,
one thing i did that every other youtube tutorial on dwm seems to miss is how to apply the changes to a separate git branch
 and then merge the changes back into the master branch






I cover the changes you need to make to the config files to get dwm, st and slstatus to build on freebsd an linux,
how to set the font, change the shell, apply the move stack patch to dwm and the scrollback patch to the st terminal

Some notes

+ dwm freebsd notes
+ st terminal freebsd notes

My freebsd builds of dwm, st, and slstatus

+ dwm freebsd
+ st terminal freebsd
+ slstatus freebsd


----------



## usonianhorizon (Jun 3, 2020)

I wish that the Makefiles had notes directly for FreeBSD as they do (at least some of them) for OpenBSD.


----------



## scottro (Jun 3, 2020)

You can also use the port, edit the config.h file, and in the  make install command use `DWM_CONF="path-to-config.h"'`
Not sure what notes you mean but using the DWM_CONF and ST_CONF are in the Makefile.
As for patches, that too, is pretty easy with ports, put the patch file under <portname>/files, though I've found some patches didn't work for me under FreeBSD, though that may be because they're fairly old patches--don't think they work under Linux anymore either, :-(


----------



## usonianhorizon (Jun 4, 2020)

Sorry, I should have been clearer: I downloaded direct from suckless.org and manually patched with the available patches I wanted (not many), but also sometimes my own customizations.  This was for dwm, dwm-bar (made my own battery status indicator script; and the next local ISS passby time  ), st, slock, sent, etc.

I was referring to have OS agnostic Makefiles as in:


```
# FreeBSD
X11INC = /usr/local/include/
X11LIB = /usr/local/lib
```

rather than the usual 
	
	



```
/usr/X11R6/include
```
 and 
	
	



```
/usr/X11R6/lib
```

It would be nice to just have it compile out of the box, at least for those just wanting to give it a try. I noticed sometimes the source Makefiles reference OpenBSD, although not always.  But no reference to FreeBSD.

I should have though of starting with Ports, but I didn't know if they were matched to current.


----------



## usonianhorizon (Jun 4, 2020)

Of course, I meant config.mk rather than Makefile.


----------



## TheUser (Aug 12, 2020)

I can't compile *st* terminal, following your steps from NapoleonWils0n GitHub

Error:


```
In file included from x.c:15:

/usr/local/include/X11/Xft/Xft.h:39:10: fatal error: 'ft2build.h' file not found

#include <ft2build.h>


1 error generated.

*** Error code 1


Stop.
```


----------



## mitko17 (Sep 19, 2020)

TheUser said:


> I can't compile *st* terminal, following your steps from NapoleonWils0n GitHub
> 
> Error:
> 
> ...



Please don't make the same mistake as me and make sure you have installed pkgconf...


----------



## Dev-Raiden (Apr 26, 2021)

TheUser said:


> I can't compile *st* terminal, following your steps from NapoleonWils0n GitHub
> 
> Error:
> 
> ...


actually I am solved this issue with installing pkg-config 

`$  doas pkg install pkg-config`

but the new bug will raise to you by the making install for st.

the issue is 


```
tic -sx st.info 
make[1]: exec(tic) failed (No such file or directory)
*** Error code 1

Stop.
make[1]: stopped in /home/raiden/Desktop/Build/Suckless/st
```

I am walking in the same steps in tutorial but the (tic) not can be found. 

today is my first day in FreeBSD after years in Linux and still need someone guide me.

Note: FreeBSD version 13


----------



## Fuzzbox (Apr 26, 2021)

Hi,

tic is provided by ncurses :
`pkg install ncurses`


----------



## serg201 (Jul 8, 2021)

Hi guys
The slstatus shows incorrect information about computer memory.
Total ram on a computer 16 gigabytes
OS FreeBSD 12.2.
Whats wrong?

```
% ./slstatus -s
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
RAM_PERC:0%  RAM_FREE:3.4 Gi  RAM_USED:16.0 Ti  RAM_TOTAL:16.0 Ti
```

my config.h

```
static const struct arg args[] = {
  /* function format          argument */
  { ram_perc, "RAM_PERC:%s%%",    "" },
  { ram_free, "RAM_FREE:%s",      "" },
  { ram_used, "RAM_USED:%s",    "" },
  { ram_total, "RAM_TOTAL:%s",     "" },
};
```

thanks for advice


----------



## Fuzzbox (Jul 8, 2021)

Looks like ram.c is indeed broken for FreeBSD. I don't use this component, but I've just tested it and I get the same results than you.
I see two solutions : fixing the code, or calling a custom external script.


----------



## astyle (Jul 19, 2021)

Something wrong with using the C API to just call the command line utility to query the RAM? There's quite a few ways to do that, such as `uname -a` to fish out how much RAM you actually have. OR `top` to fish out the percentages.


----------



## Marka (Jul 30, 2021)

TheUser said:


> I can't compile *st* terminal, following your steps from NapoleonWils0n GitHub
> 
> Error:
> 
> ...


Hi, 

Has anyone come up with a solution for this or should I search out another window manager.  I love dwm and dmenu, but st is not looking good.  This error comes up on any compile whether it's from an individual or from the suckless repo. 

Thanks


----------



## Tieks (Jul 30, 2021)

Marka said:
			
		

> fatal error: 'ft2build.h' file not found



A header file (extension .h) is missing. On my FBSD v13 I have this:
`find / -iname ft2build.h -type f 
/usr/local/include/freetype2/ft2build.h`

Check if you have that file installed (it comes with /usr/ports/print/freetype2). Then check if that location is in your include path (the place with other .h files), or copy the file to your include path.


----------



## scottro (Jul 30, 2021)

If you love dwm and dmenu, but are having problems with st, why not use another terminal? Change the st in the term command definition to urxt or whatever terminal you want. 

I also don't understand why you don't just create your own st/config.h file and build the port with

```
ST_CONFIG=/home/user/st/config.h
```
. It seems as if you're overcomplicating it. I haven't read every post in this thread so I may have missed something, but FreeBSD makes it quite easy to build st with a custom configuration. If you're adding patches, then they can go in /usr/ports/x11/sterm/files. 

The FreeBSD port is usually very up to date. If it isn't, you can email the package maintainer. For example, for awhile, dmenu was having an issue, the fix was available in an update. I emailed the maintainer and the port was updated the next day. 
As I said, I haven't read the whole thread, so you may have a special reason for using github rather than the port, but the port works fine, including using custom config.h and any patches.[/file]


----------

