HACKER Q&A
📣 helij

Linux Wayland Screenshot App – where to start?


I really like the screenshot app on Fedora. It works flawlessly but sometimes I drop screenshots into graphics program (Gimp) to draw arrows, etc. Would be really nice if everything was integrated together.

I programmed in Basic in the 80' and 90' and Pascal/Delphi in early 00'. After that Python and Django for the usual web stuff. It's been awhile since I did major projects - mainly Python scripts now if needed (scraping and data)...If I would to build this kind of app from scratch where do I start?


  👤 sylware Accepted Answer ✓
As far as I know, this is not part of wayland core, namely you would need an specific and out of core wayland interface AND a wayland compositor which supports such interface.

Go to the wayland authority repo for interfaces, see if there is such interface (there could be many in dev), then find a wayland compositor which supports such interface(s) (or code such compositor). Then write your app code to query if a wayland compositor supports such interface:

- if not, gracefully fail.

- if it does, screenshot your surfaces.

That said, it is more an internal feature of a wayland compositor itself. So it seems more appropriate that a wayland compositor supports or not such feature, and if so, optionaly allows an application to remote control of feature via a specific out-of-core wayland interface.

I would feel better if it stays into the wayland compositior without the possibility for an external apps to snapshot everything.

That said, you could fiddle with platform specific stuff to shorcut the wayland compositor (on linux, drm mode settings and framebuffers).


👤 Zambyte
Have you seen flameshot? https://flameshot.org

I haven't used it personally - I hacked together a Guile script to wrap a few tools (grim, slurp, tesseract for OCR..., wofi), and then bound my script to a shortcut in my WM.


👤 smoldesu
Probably start with wlroots if you want to target multiple Wayland desktops. There are multiple compositor implementations now, so grabbing a framebuffer isn't quite as easy as it was in the 90s.

You should check out Flameshot and Spectacle if you want feature-complete screenshot apps on Wayland. If those don't suit your needs, then you should consider a custom solution.