How to make Screenshot in DWM with maim format string in C to execute command -

325 views Asked by At

I want to create shortcut to make screenshots in DWM with maim.

Command works for bash but for C there are spaces and symbols so DWM can't execute this command correctly.

static const char *maim[]  = {"maim ~/Screenshots/$(date +%F-%H_%M_%S).png", NULL };
1

There are 1 answers

0
skink On

Commands with substitutions should be executed in shell, so the right syntax is:

static const char *maim[] = { "/bin/sh", "-c", "maim ~/Screenshots/$(date +%F-%H_%M_%S).png", NULL };