2

I'm new to dwm (suckless.org) and also to GNU/Linux. I know a bit of the C language but don't really understand the config.h file.

SYS-CONFIG

I use Ubuntu 18.04 (installed with netinstaller + vanilla gnome...) and recently I wanted to try dwm 6.2.

HOW I INSTALLED IT

I downloaded the tar.gz file from the suckless.org website and for install I just typed make in terminal in that folder (without any error) and I also installed the dwm via Ubuntu repository and finally created a symbolic link in ~/bin/ thereafter, I created a .xinitrc in home folder and put exec dwm in that. then I rebooted, and logged in. I didn't change the config file.

PROBLEM

The default keybinding, Shift+Alt+Enter doesn't open gnome-terminal.

config.h

/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
    { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* 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 *termcmd[]  = { "st", NULL };

static Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
    { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
    { MODKEY,                       XK_b,      togglebar,      {0} },
    { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
    { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
    { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    { MODKEY,                       XK_Return, zoom,           {0} },
    { MODKEY,                       XK_Tab,    view,           {0} },
    { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    { MODKEY,                       XK_space,  setlayout,      {0} },
    { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    TAGKEYS(                        XK_1,                      0)
    TAGKEYS(                        XK_2,                      1)
    TAGKEYS(                        XK_3,                      2)
    TAGKEYS(                        XK_4,                      3)
    TAGKEYS(                        XK_5,                      4)
    TAGKEYS(                        XK_6,                      5)
    TAGKEYS(                        XK_7,                      6)
    TAGKEYS(                        XK_8,                      7)
    TAGKEYS(                        XK_9,                      8)
    { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
}; 
6
  • 1
    The proper way to install suckless software is to make then make install so you don't have to symlink manually the binary. Could you please provide the "key definitions" and "commands" sections of your config.h file?
    – user413007
    Jun 24, 2020 at 7:41
  • Thanks for the helpful edit. I'm new to this kinds of websites. How can I post it here? copy paste the whole thing in the comments or attach the file?
    – ali b
    Jun 24, 2020 at 7:48
  • Just edit your question by pasting the desired sections of the file. Make sure to use code syntax highlighting to have a proper formatting.
    – user413007
    Jun 24, 2020 at 7:54
  • thanks man. I post those lines that you've mentioned.
    – ali b
    Jun 24, 2020 at 8:48
  • I fixed it by changing the default terminal from st to gnome-terminal. I learned how to ask more properly. this was my first question. thank you Loic!!!
    – ali b
    Jun 24, 2020 at 9:05

2 Answers 2

2

Here is the problem:

static const char *termcmd[] = { "st", NULL };

The dwm build from suckless.org uses st as default terminal emulator therefore Alt+Shift+Enter is mapped to st which is not installed on your system. You need to change st to gnome-terminal or whatever other terminal emulator you want (and which is installed on your system).

Once you edited the configuration file run make and make install to apply the changes to your system.

1

In default config.h of dwm, there are two lines involved to execute a terminal:

static const char *termcmd[] = { "rxvt", NULL };
I use rxvt, you can change it to gnome-terminal

{ MODKEY, XK_Return, spawn, {.v = termcmd } },
Which sets the keyboard shortcut to constant termcmd. In my case it's just Meta+Enter.

Also, as noted in comments, you should compile dwn, sudo make clean install. Only after compiling, changes of config.h are applied (there are patches of dwm to overcome this). You can edit config.mk before compliling if you like, for example to change path of executables.

2
  • It worked. I should've change the default terminal. It's a bit strange, cause I remember I installed st via repository but it didn't work too. I guess I should read and study source code (I guess I'm too dump for dwm now :) ). again thanks man!!!
    – ali b
    Jun 24, 2020 at 9:02
  • @alibb if you installed st from Ubuntu repositories you need to change st to stterm.
    – user413007
    Jun 24, 2020 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.