Taking screenshots of an area doesn't work via keyboard shortcut


#1

On Ubuntu 14.04, if the keyboard shortcut does not work to take screenshots of a selected area, follow this link:

Shortly:
In /usr /local/ bin create a script with executable permissions and name it mate-screenshot.
This script introduces a delay that allows mate-screenshots to run the command with the ‘-a’ option

#!/bin/bash
sleep 1
exec /usr/bin/mate-screenshot [email protected]

In the script above, the second row, I put sleep 0. 5 to decrease the time, with 0. 1 is too short and it doesn’t work.
Then create keyboard shortcuts:

Add->
Name: Select Area
Command: /usr/local/bin/mate-screenshot -a

Then match the desired keys. (I used Alt+A)

P.S.
My OS: Ubuntu Mate 14.04 Mate-utils 1.8.2+dfsg1-1~trusty1
On Ubuntu Mate 16. 04 (virtualized on VmWare) I had no need of this script,
I just added the ‘mate-screenshot -a’ command to the keyboard shortcuts.


Italiano forum Ubuntu.it


#2

I used the command: “mate-screenshot --interactive” so i can choose: screen-window-selection


#3

Yes, mate-screenshot --interactive is the same command you can find in the mate menu (accessories- take screenshot).

In the other way you can have 3 separate keyboard shortcuts:

Print -> grab the whole desktop
Alt Print -> grab the current window
These two are default, plus the third one to grab the selected area.

I tested this workaround on Ubuntu Mate 14.04.
On Ubuntu Mate 16. 04 I just added the ‘mate-screenshot -a’ command to keyboard shortcuts (no need of scripts)


#4

I have Ubuntu Mate 17.04 installed on a late 2008 MacBook, which does not have a Print key on the keyboard. My solution was to enabled screenshot key bindings by adding the following commands to CompizConfig Settings Manager > Commands.

mate-screenshot (Key Bindings p)
mate-screenshot -w (Key Bindings w)
mate-screenshot -a (Key Bindings a)

Very similar to what you did in UM 16.04, except for setting key bindings for all three.


#5

I found myself switching to gnome-screenshot because I cannot directly copy the taken screenshot to clipboard using mate-screenshot.

Does someone have another workaround for that using mate-screenshot?

Related discussion on Github:


#6

I did not know this feature.
I installed gnome-screenschot via synaptic and with “gnome-screenshot -a -c”
I can directly copy the taken screenshot.

Unfortunately there is no “-c” option for mate version
http://manpages.ubuntu.com/manpages/xenial/man1/mate-screenshot.1.html
I think I will also use gnome instead of mate-screenshots, indeed I’ve already put a launcher on the panel with this command.

Meanwhile, I found another solution for the keyboard shortcut , no need of script :

bash -c “DISPLAY=:0.0 mate-screenshot -a”
See the first reply of the following link


#7

Thanks, @Mary!

Hopefully, they will implement this clipboard feature into mate-screenshot. :slight_smile:


#8

To sum up:

  1. Grab the entire screen and grab current windows as default with Mate screenshots and related shortcuts.

  2. To grab a selected area (without copy to clipboard):
    Try first the commad mate-screenshot -a in a keybord shortcut , if it does not work (in UM 14.04) set:

Bash -c “DISPLAY =: 0.0 mate-screenshot -a” ( see the link in post 6 for parameters of display )

n3. To grab a selected area with direct copy to the clipboard (no Gui) I used the workaround in my first post:

  • install gnome-screenshot

  • The script in /usr/local/bin , I renamed it gnome-screenshot and changed the third line

    #!/bin/bash
    sleep 0.5
    exec /usr/bin/gnome-screenshot [email protected]

  • I made a shortcut
    /usr/local/bin/gnome-screenshot -a -c

Otherwise, in UM 14.04, even for gnome-screenshot there is the same drawback as my first post, so you need to set a delay.
Strangely, if instead of the keyboard shortcut I want to use a panel launcher, there is no need of this workaround and the “gnome-screenshot -a -c” command works perfectly.
The same thing happened to me with “mate-screenshot -a”: launcher works but shortcut doesn’t.


#9

Hallo orschiro

Have you tried “Shutter”? It’s a screenshot tool that I wouldn’t want to be without. :slight_smile:


#10

I have this one, too. :slight_smile:

But your ensparking a new idea:

Do you know if Shutter has a command-line equivalent to gnome-screenshot -ac?


#11

Hallo

I don’t know. I only use it as a GUI tool.

However, I just called up the man-pages and there do seem to be terminal commands and options. Why not install it and see if it has what you are looking for?


#12

Cool.

shutter -s allows me to take a selection and adds it automatically to the clipboard. :slight_smile:


#13

Thanks, so I also tried shutter, it works for me the command shutter -s -e
otherwise with shutter -s the gui appears.
You can draw arrows and more

http://shutter-project.org/about/


#14

The only drawback is that Shutter hasn’t seen a new release in years. And I found some bugs that I wish someone would address. Well, let’s hope for the development to become more active again!


#15

screenshot_area.sh
#!/bin/bash
mate-screenshot -i &
sleep 0.1
xdotool search --onlyvisible --name ‘^Take Screenshot$’ key Down
xdotool search --onlyvisible --name ‘^Take Screenshot$’ key Down
xdotool search --onlyvisible --name ‘^Take Screenshot$’ key Return

boom


#16

in ubuntu mate 14.04 just set the command to
bash -c "sleep 0.05; mate-screenshot --area"
or whatever minimum sleep time is necessary for you. for some reason there have to be some sleep time. no need for additional script