14

I want to write a simple tool that will take screenshots at Wayland. Am I right in my understanding that it would be completely different from Xorg? Could anybody give me any examples?

Alexander L. Hayes
  • 3,892
  • 4
  • 13
  • 34
Suliman
  • 1,469
  • 3
  • 13
  • 19

3 Answers3

7

Your question is a bit underspecified. You don't need to write a tool as long as you use the reference compositor Weston for Wayland. It has this feature built in. You can use Super + S to take a screenshot and Super + R to record a video in *.wcap form which you can then convert to a *.webm video.

If you should really be interested in writing such a tool then you should look at Weston's source code here: http://cgit.freedesktop.org/wayland/weston and find the relevant parts.

lord.garbage
  • 5,884
  • 5
  • 36
  • 55
3

Yes screenshotting works completely different under wayland than under Xorg.

By design, Wayland is a lot more secure than X11 and does not allow one application to capture the content of other applications' windows, meanignath a X11 based screenshot tool cannot work underWayland/Xwayland.

https://bugs.freedesktop.org/show_bug.cgi?id=98672

Sorry I cannot tell you how it is different, just that it is different.

Lesmana
  • 25,663
  • 9
  • 82
  • 87
0

I used to use shutter but it fails with Wayland.

gnome-screenshot works with Wayland but in itself is clunky when it comes to rename files straight after grabbing.

I made 2 scripts: shut.sh

#!/bin/sh
# call me shut.sh
gnome-screenshot -a -f /path/to/temp/grabcache.png
gnome-terminal -e "bash grabname.sh"

and grabname.sh

#!/bin/sh
# call me grabname.sh
read -p "Name for grab? " grab
cp /path/to/temp/grabcache.png /where/you/want/it/$grab.png
nautilus /path/to/temp

Now define a hot key to run shut.sh . You will need to specify the exact paths to each script unless you save the scripts to a location in your $PATH variable for the shell.

Then, when you press your key, a cross-hair will appear on the screen for you to select a grab target. This saves grabcache.png to /path/to/temp.

When done, terminal will open and ask you for a file name to copy grabcache.png to $grab in /where/you/want/it. Then, nautilus should open to show you the new renamed grab. If nautilus is already open, you may have to ALT-TAB to it manually.

kadeg
  • 31