bakkeby/dmenu-flexipatch

multiselect.c missing?

Closed this issue · 4 comments

fov95 commented

Hi, when compiling with multiselect patch set to 1 I get error that multiselect.c is missing. And there is no multiselect.c in the patches folder..

Thanks for bringing this to my attention, it must be a patch file which I have somehow forgotten to add to git. I'll get it added first thing in the morning.

In the meantime here is the content of that file.

static int
issel(size_t id)
{
	for (int i = 0;i < selidsize;i++)
		if (selid[i] == id)
			return 1;
	return 0;
}

static void
printsel(unsigned int state)
{
	for (int i = 0;i < selidsize;i++)
		if (selid[i] != -1 && (!sel || sel->id != selid[i]))
			puts(items[selid[i]].text);
	if (sel && !(state & ShiftMask))
		puts(sel->text);
	else
		puts(text);
}

static void
selsel()
{
	if (!sel)
		return;
	if (issel(sel->id)) {
		for (int i = 0; i < selidsize; i++)
			if (selid[i] == sel->id)
				selid[i] = -1;
	} else {
		for (int i = 0; i < selidsize; i++)
			if (selid[i] == -1) {
				selid[i] = sel->id;
				return;
			}
		selidsize++;
		selid = realloc(selid, (selidsize + 1) * sizeof(int));
		selid[selidsize - 1] = sel->id;
	}
}
fov95 commented

Nice, thank you. Do you happen to know how to change the color of the multiselect selection? It doesn't obey the select colors I set in Xresources and Couldn't find anything in the files... I'm not a programmer, just a hobbyist... =)
multiselect
That's not the actual Xresources. I picked the wrong one, that's just the template for "wpgtk" but the colors work as one can tell so it's nothing wrong with it.

Hi @der-Zonk,

I added that missing file now.

I had a look and it is the SchemeOut colors that are used when selecting multiple items (also in a bare dmenu). The multi select patch just avoids outputting the item as soon as you do ctrl+enter and instead waits until you just press enter and then prints them all out at the end - that way you can unselect options as well.

To set these colors via Xresources you need to set the outforeground and outbackground resources.

dmenu.outforeground: {color#}
dmenu.outbackground: {color#}


Thanks,

-Stein

fov95 commented

I'm a dummy. Thanks a lot. =)