You are not logged in.

#1 2023-10-16 04:06:57

scatherinch
Member
Registered: 2023-02-24
Posts: 168

[SOLVED] Request: MAIM/Scrot Snipping Script

Hi. I used to use flameshot for this, but for technical reasons, have decided to discard this program in favor of maim. Maim is fantastic, but I find it tedious to use in a way similar to flameshot where it hung out on the tray.

I was wondering if anyone could offer me a script that could run

maim -so ./Pictures

The problem here is that maim can't read my mind when I want  to make a screen snip, thus, everytime I want to do this, I tell it to ignore the compositor with the o flag and select the screen with the s flag and then I need to tell it where the output file gets saved, in this case, I like to use jpegs.

I'm on awesome and I'm running a custom setup. I was wondering if anyone knew how to program maim into it where I could hit a button and it will automatically go into snipping mode with a preselected destination (./Pictures) in this case.

Last edited by scatherinch (2023-10-18 08:34:20)

Offline

#2 2023-10-16 10:59:04

raggerv8
Member
From: Sweden
Registered: 2010-07-01
Posts: 119
Website

Re: [SOLVED] Request: MAIM/Scrot Snipping Script

You don't necessarily need a script. You could bind this command to a key, so that for example pressing PrtScn runs that command, takes a screenshot and places it in ~/Pictures.
Since you probably need a file name and you want that file name to be unique every time (so you can take screenshots without replacing old files) you can use the date command. shot-$(date "+%s").jpeg (Unix time) should make a file called shot-1697453718.jpeg for example. If you want the date to actually be readable you could use %F-%s instead to append a human readable format before UNIX time.


Brottweiler at #archlinux

Use IRC and Mumble for online communication!

Offline

#3 2023-10-16 18:15:48

scatherinch
Member
Registered: 2023-02-24
Posts: 168

Re: [SOLVED] Request: MAIM/Scrot Snipping Script

a good suggestion.

that command does indeed work from the CLI, but I noticed it doesn't function correctly when I try and run it from awesome's launcher (meta + r). So how would I go about binding it then? Having to just press a key would be much easier.

 maim -so ~/Pictures/$(date +%s).jpg

Last edited by scatherinch (2023-10-16 18:20:30)

Offline

#4 2023-10-17 08:38:03

raggerv8
Member
From: Sweden
Registered: 2010-07-01
Posts: 119
Website

Re: [SOLVED] Request: MAIM/Scrot Snipping Script

You may have to use the -c option, so try bind the key to the following.

/bin/sh -c "maim -so ~/Pictures/$(date +%s).jpg"

Last edited by raggerv8 (2023-10-17 08:38:18)


Brottweiler at #archlinux

Use IRC and Mumble for online communication!

Offline

#5 2023-10-18 07:30:20

scatherinch
Member
Registered: 2023-02-24
Posts: 168

Re: [SOLVED] Request: MAIM/Scrot Snipping Script

Alright, so I didn't figure out how to bind that key to prntscreen using my window manager, but I did solve the problem.

What I did was made a simple shell script with your advice and then just put it into my home directory and ran it from Awesome. Thank you!

meta + r ./<shellscript containing maim input>

Last edited by scatherinch (2023-10-18 07:39:58)

Offline

#6 2023-10-18 16:31:45

raggerv8
Member
From: Sweden
Registered: 2010-07-01
Posts: 119
Website

Re: [SOLVED] Request: MAIM/Scrot Snipping Script

It should be enough to bind it like this.

meta + r /bin/sh -c "maim -so ~/Pictures/$(date +%s).jpg"

If it doesn't work, then it might be different syntax in awesome. Last time I used awesome was in 2008, so not sure how the syntax is. If a script works better for you then great! Glad you could solve it.


Brottweiler at #archlinux

Use IRC and Mumble for online communication!

Offline

Board footer

Powered by FluxBB