DWM Installing dwm manually vs pkg

Hi

I thought id give the dwm window manager a try,
im using i3wm at the moment

There is a dwm package but to change dwm's config you have to edit the source code and then compile it
Has anyone tried the dwm pkg and if you use the pkg i guess it means you cant change the config

Has anyone manually installed dwm on freebsd, i guess you just download the code with git change the config,
compile the code then move the binary to /usr/local/bin
 
Has anyone manually installed dwm on freebsd, i guess you just download the code with git change the config,
compile the code then move the binary to /usr/local/bin
I have and is quite simple. First you clone the https://suckless.org repos with git and then you need to modify config.mk so that x11-wm/dwm can compile on FreeBSD. More precisely in config.mk you need to add local at lines X11INC and X11LIB insted of X11R6 and just local at line FREETYPEINC. After that you can modify config.def.h as you desire.

eg.
Code:
git clone https://git.suckless.org/dwm

cd /dwm

vim/nano/ee config.mk

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

#exit vim/nano/ee and modify your config.def.h as you want it; then just instal it.

sudo make clean install.

# add entry to .xinitrc.

Keep in mind that after you install dwm it's kinda spartan so you will feel the need to patch it. To do that download the patches you want in the build directory and apply them.
Let's apply for example the attachbelow patch which make new clients attach below the selected client, instead of always becoming the new master.
Code:
cd /dwm

patch -p1 < dwm-attachbelow-6.2.diff

sudo make clean install

After you modify your "config" file either by hand or by applying patches you need to recompile the source code every time. Also if you apply too many patches the compiler is gone generate errors so manual intervention is needed.
 
  • Thanks
Reactions: a6h
I use dwm daily on my laptop, and I love it!

For reference, here is my forked GitHub repo with a customised config.h, along with a hacked up version of slstatus to work on FreeBSD;

dwm/freebsd

slstatus/freebsd

screenie.png


If you have your own fork of dwm with a customised config.h, then installing is simply;
git clone <url>
cd dwm
sudo make install
 
Thanks chaps

i did find a youtube video about setting up dwm on freebsd
which mentioned editing the config.mk and making the changes minbari suggested so good to have it confirmed

i like your icons jaw especially beastie

couple of things i need to work out are how to change the mod key from alt to the windows key
and setting the terminal to open with the windows key and enter
 
cheers jaw for the modkey and terminal

i cloned the git repo rather than downloading the release
and the git version has a config.def.h but not a config.h but i can see the options to change

note to self rtfm

A vanilla download of dwm will contain a file called config.def.h, a template you can use to create your own config.h file.
To start customising dwm, simply copy config.def.h into config.h before you run make.

To quit dwm cleanly:
[Shift]+[Alt]+[q]

i already have font-awesome installed so that's handy

do you use pkill X and then startx after you have made changes and done sudo make clean install
 
You can, as the makefile tells you, edit your config.h (get it from github or do make extract in the port directory), then build with
make DWM_CONF=<path to your custom config.h file> install clean.
Note that for many people dmenu doesn't work. If you try to put a command in it just stays blank. You're better off installing dwm-4.8. Once you've installed dwm, you can delete dmenu with pkg remove -f (doing plain package remove will also take out dwm). You can probably easily build it from source or look for the old port, which I think would be in FreeBSD-10 at http://pkg.freebsd.org/

By the way there's an excellent howto about editing the config on the Debian forums. http://forums.debian.net/viewtopic.php?f=16&t=65110
 
You can, as the makefile tells you, edit your config.h (get it from github or do make extract in the port directory), then build with
make DWM_CONF=<path to your custom config.h file> install clean.
Note that for many people dmenu doesn't work. If you try to put a command in it just stays blank. You're better off installing dwm-4.8.

The x11-wm/dwm port is nice in that it provides some out the box port options (SUPERASMODKEY, VOLUMECONTROL, etc). I've been meaning to switch over to using the port, and possibly adding some more dwm patches as options such as focusonclick, statusallmons, etc.

I've not once had an issue with dwm + dmenu, seems odd they wouldn't work together!
 
It is also possible to generate a custom x11-wm/dwm using the ports tree. It needs following the porters handbook which is a perfect guideline. It is a good idea to copy the files in /usr/ports/x11-wm/dwm/files to a safe place because a make patch deletes them if there is not *.orig. You can tweak the config file until you are happy with the executable in the work directory. Then run make patch to generate a usr/ports/x11-wm/dwm/files/patch-config.def.h. Afterwards clean up everything and restore the original patch files. Then make install should to everything in the official FreeBSD way using the package system. With pkg lock the custom made package of x11-wm/dwm will not be overwritten in case of an update. Please have a look in the porters handbook for detailed explanations.

It should be not impossible to generate usr/ports/x11-wm/dwm/files/patch-config.def.h directly. Mine is slightly different from the default one as below:
Code:
--- config.def.h.orig   2019-02-02 12:55:28 UTC
+++ config.def.h
@@ -56,7 +59,7 @@ static const Layout layouts[] = {

 /* commands */
 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+static const char *dmenucmd[] = { "/usr/home/chris/scripts/dmenu_wrap.sh", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
 static const char *termcmd[]  = { "st", NULL };

 static Key keys[] = {
 
I have dwm set up,
but one thing that has got me baffled is using feh to set the wallpaper

In my i3wm config i start feh using

Bash:
exec --no-startup-id ~/.fehbg

which then runs this script

Bash:
#!/bin/sh
feh --no-fehbg --bg-center --image-bg '#002b36' '/home/djwilcox/.wallpaper/freebsd.png'

I dont use a login manager, i just startx
So i tried starting feh from ~/.xinitrc when using dwm but its not working

Any dwm got any tips on setting the wallpaper with feh

One thing i noticed compared to i3wm is firefox pip window doesnt leave trail when you drag the window,
with i3wm when i drag the firefox pip window which has a blue border it leaves a blue trail on the screen which i dont get with dwm
 
I have dwm set up,
but one thing that has got me baffled is using feh to set the wallpaper
So i tried starting feh from ~/.xinitrc when using dwm but its not working

Any dwm got any tips on setting the wallpaper with feh

~/.xinitrc
Code:
# Fix for Java GUI applications grey window with non-reparenting WMs (such as DWM below)
export _JAVA_AWT_WM_NONREPARENTING=1

# Set background for DWM
feh --no-fehbg --bg-scale --randomize ~/Wallpaper/

# Start Status Bar
/usr/local/bin/slstatus &

# Start DWM
exec /usr/local/bin/dwm
 
I use dwm daily on my laptop, and I love it!

For reference, here is my forked GitHub repo with a customised config.h, along with a hacked up version of slstatus to work on FreeBSD;

dwm/freebsd

slstatus/freebsd

screenie.png


If you have your own fork of dwm with a customised config.h, then installing is simply;
git clone <url>
cd dwm
sudo make install


A bit off topic, I'm in the process of setting up DWM. I'm able to run startx and enter, but I'm unable to get a terminal window to open. If I run `doas(sudo) startx` I get the legacy window manager with terminals.

I'm able to set the keyboard layout and have verified its not a keyboard issue. As I can change screens using 'alt + num' and my exit command works.

Any idea why I'm unable to open a terminal?
 
Does $HOME/.xinitrc have exec dwm as the last line? I think the default terminal is st and if you don't have that installed, and haven't changed your custom config, that might be the answer.
 
A bit off topic, I'm in the process of setting up DWM. I'm able to run startx and enter, but I'm unable to get a terminal window to open. If I run `doas(sudo) startx` I get the legacy window manager with terminals.

I'm able to set the keyboard layout and have verified its not a keyboard issue. As I can change screens using 'alt + num' and my exit command works.

Any idea why I'm unable to open a terminal?
Are you able to use dmenu (Alt-p by default) to open a different terminal such as xterm? Clearly xterm works outside of DWM if you were able to start X with the default TWM set-up as root. If xterm works in DWM too, try executing st in xterm and see if any error messages are displayed. Unless you changed termcmd in your config.h, it defaults to st with no arguments.
 
Does $HOME/.xinitrc have exec dwm as the last line? I think the default terminal is st and if you don't have that installed, and haven't changed your custom config, that might be the answer.

Yeah, I've got: `exec home/anon/dwm/dwm` as the last line. I have updated the config.h file to change the terminal from `st` to `iterm`. Nada.
 
Are you able to use dmenu (Alt-p by default) to open a different terminal such as xterm? Clearly xterm works outside of DWM if you were able to start X with the default TWM set-up as root. If xterm works in DWM too, try executing st in xterm and see if any error messages are displayed. Unless you changed termcmd in your config.h, it defaults to st with no arguments.

Dmenu isn't working either. (Alt-p) nothing happens.
 
What is "iterm"? Is dmenu installed? I have built x11-wm/dwm countless times both in its normal ports location and in my user's /home and never had a single issue with it, other than me not liking tiling window managers very much anymore...

I never do a pkg install because it's just a standalone executable with no dependencies: I always just compiled it and copied it to /usr/local/bin.

Is the dmenu call "shift+alt+p" or just "alt+p", I can't remember.
 
What is "iterm"? Is dmenu installed? I have built x11-wm/dwm countless times both in its normal ports location and in my user's /home and never had a single issue with it, other than me not liking tiling window managers very much anymore...

I never do a pkg install because it's just a standalone executable with no dependencies: I always just compiled it and copied it to /usr/local/bin.

Is the dmenu call "shift+alt+p" or just "alt+p", I can't remember.

Oh man, now I feel like an idiot. The correct terminal is called `xterm` and `iterm` is the macOS terminal. Wow.

dmenu is working now, and everything is back on track. Thank you!!
 
I use dwm daily on my laptop, and I love it!

For reference, here is my forked GitHub repo with a customised config.h, along with a hacked up version of slstatus to work on FreeBSD;

dwm/freebsd

slstatus/freebsd

screenie.png


If you have your own fork of dwm with a customised config.h, then installing is simply;
git clone <url>
cd dwm
sudo make install
Its window manager looks great, I like dwm a lot for its simplicity, also I only use nvim, chrome and spotify but I am having problems with the audio card, I do not take it.
Should I install full xorg? or can I install the minimum?
 
Back
Top