Using kmsgrab and triggerhappy for full-screen screenshots
-
In the past we could use
raspi2png
for screengrabs, but the tech is obsolete for modern OSes. Would like to combine a modern capture tool with triggerhappy for keyboard-triggered screen captures using the method in the thread linked above.In 2025, it seems that
kmsgrab
might be a good alternative with Bookworm, but it needs sudo/root access, which may prohibit it from running in a script. Wondering if there is a way to run kmsgrab in this fashion, or if a different tool would be required.I've already configured a triggerhappy conf file and it tries to run kmsgrab with a filename param, but it definitely needs sudo, which I think is a non-starter.
Is there a clever way to make this work?
Cheers!
-RosEDIT: I'm realizing that this may be a Pi 5 / Bookworm issue and thus is probably not ready for this forum.
-
You may succeed with giving the
kmsgrab
system admin capabilities, it does no longer require explicitsudo
then.sudo setcap cap_sys_admin+ep /path/to/kmsgrab
https://linux.die.net/man/8/setcap
https://linux.die.net/man/3/cap_from_text
https://man7.org/linux/man-pages/man7/capabilities.7.htmlI did not debug to the end, but I strongly assume at some point DRM hits this method, which bails out with
-EACCES
("Operation not permitted") when privileges are not met.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.