DEV Community

Khaled Nassar
Khaled Nassar

Posted on

the best way to configure your dwm

hello everyone, dwm is the best window manager you can use it's fast and minimalism and this the best thing i love of suckless philosophy , in this post i'll show you how to configure your dwm, we will configure keybinds & color schema & some tasks can help you for make an awesome WM
for configure your dwm (or any suckless programs) you need to change somethings in config.h

first let's start with keybinds, dwm works with ALT key if you wan't to change it from ALT to SUPER key, change config.h from #define MODKEY Mod1Mask to #define MODKEY Mod4Mask for add/remove keybinds for dwm go to keys list from config.h

static Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
    { MODKEY,                   XK_Return, spawn,          {.v = termcmd } },
    ..... etc ....
Enter fullscreen mode Exit fullscreen mode

dwm default keys for kill programs is SUPER + c , i'll change it to q

keys[] =
+ { MODKEY,                     XK_q,      killclient,     {0} },
Enter fullscreen mode Exit fullscreen mode

if you wan't to add more keybinds add a varible with your command you wan't to run with your keybind for example i need to run $ pamixer --allow-boost -i 10 for up the audio

static const char *audioup[] = { "pamixer --allow-boost -i 10",NULL };

{ MODKEY,                       XK_{KEY},      spawn,          {.v = {COMMAND} } }
{ MODKEY,           XK_p,      spawn,      {.v = audioup}},

// SUPER + p = audioup command
Enter fullscreen mode Exit fullscreen mode

take the idea and make your own keybinds or if you hate to configure your keybind from C code you can use sxhkd with simple config file :)

for change the terminal from ST to your fav terminal go to config.h and search for termcmd[] and change the value from st to terminator for example

for change the font of dwm go to your config.h file and search for fonts[] and change the value to your fav font name & size for example

static const char *fonts[]          = { "monospace:size=13" };
Enter fullscreen mode Exit fullscreen mode

for change your colorschema search for static const char col_gray and change what you wan't with color picker, or you can use Pywal to generate colorschema with your wallpaper
$ wal -i wallpaper.png

and add this line #include "/home/${your username}/.cache/wal/colors-wal-dwm.h" for your config.h and remove this lines from config.h

static const char *colors[][3]      = {
    /*               fg         bg         border   */
    [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
    [SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },

Enter fullscreen mode Exit fullscreen mode

and remove [SchemeUrg] = { urg_fg, urg_bg, urg_border }, from ~/.cache/wal/colors-wal-dwm.h, now your colorschema will generate with your wallpaper.png

Alt Text

if you want to add auto start function for your dwm you can use cool autostart patch , after patch with $ git apply cool-autostart.diff you need to add this line for config.h with your commands

static const char *const autostart[] = {
    "compton", NULL,
    "wal -R",NULL,
Enter fullscreen mode Exit fullscreen mode

after that run $ sudo make clean install and enjoy :)

Top comments (0)