Open ncmpcpp on a particular tag

Hoping someone can help, I launch ncmpcpp in dwm with a keybind of super+m and I can’t get it to open on the tag I want. I have tried adding this to my config.h to no effect:

{ "st", NULL, "ncmpcpp", NULL, 1 << 1, 1, 0, 0, 1 },

Does anyone have any ideas?


1 Like

I think where you have “ncmpcpp” is the title for the terminal (st in this case) that is running ncmpcpp, not the ncmpcpp itself.

Take a look at how tmux, ssh, and mutt are configured in this config.def.h -

I think you will need to do the same for ncmpcpp.

In your line of code you have posted, the class will also be NULL. Then define an ncmpcpp function where the terminal has the title ncmpcpp and launches the application.

1 Like

I just recompiled dwm to launch tmux and mc this way, so I suspect it will work with ncmpcpp.

dwm config.h snippets -

static const Rule rules[] = {
	{  NULL,         NULL,      "tmux",     1 << 1,       0,           -1 },
	{  NULL,         NULL,      "mcfm",     1 << 1,       0,           -1 },

/* commands */
static const char *tmuxcmd[]       = { "uxterm", "-title", "tmux", "-e", "tmux", NULL };
static const char *mcfmcmd[]      = { "uxterm", "-title", "mcfm", "-e", "mc", NULL };

static Key keys[] = {
	{ MODKEY,                       XK_F1,     spawn,          {.v = tmuxcmd } },
	{ MODKEY,                       XK_F2,     spawn,          {.v = mcfmcmd } },

I do it by setting the class when spawning st. Try setting this and set the tag you want it to spawn on

/* class   		 instance	   title ...
{ "ncmpcpp",      NULL,    	   NULL, ...

and your keybind

{ ALTKEY|ShiftMask,		XK_n,		spawn,		SHCMD("st -c ncmpcpp -e ncmpcpp") },

Thanks @PackRat and @rml.

@rml’s solution seemed to work for me.

I do plan on taking a good look through jwr’s configs. He seems to have a solid setup.


I think part of the issue was that I was asking ncmpcpp to use a particular config file which I had named config-classic. Maybe it was getting confused?