DWM Setting up maim for screenshots in Suckless DWM

Status
Not open for further replies.
Hi everyone,
I'm a newbie to all of this.
I installed DWM to Ubuntu server, and want to set up a hotkey for using maim to take screenshots.
I want to have two hotkeys:
  • For a screenshot that gets stored on my desktop
  • For a screenshot that gets stored in my clipboard
I have not been able to get this to work.
I added a new hotkey to DWM's config.h:
Code:
{ MODKEY,                       XK_o,      spawn,          {.v = screenshot2 } },

and using this called screenshot2:
Code:
static const char *screenshot2[] = {"maim", "-s", "~/Desktop/screenshot.png"};

The hotkey works, letting me take a screenshot, but the screenshot is not saved. Running the same command in the terminal, I find that "Maim failed to open file for writing".
It works when I add sudo to run it, but that causes it to no longer show up when using the dwm hotkey.

Separately to this, I also made a batch file which I call with another hotkey via a function:
Code:
static const char *screenshot1[] = {"./screenshot.sh", NULL };

The contents of screenshot.sh are:
Code:
maim -s | xclip -selection clipboard -t image/png

For storing the screenshot in my clipboard. This does not work either, and maim does not even start.

What am I doing wrong? Is it all about writing permissions?

Thank you very much!
 
This is a FreeBSD forum; your DWM is running on Ubuntu. Please ask your question on an Ubuntu-centric forum.
 
Status
Not open for further replies.
Back
Top