Hi all,
I’m developing a digital signage app with Electron, packaged as a Snap, running as a daemon under Ubuntu Frame using Wayland (on Ubuntu Server 22.04 and 24.04).
The app has two main goals:
- Load and display content (HTML, CSS, JS) from a URL.
- Take screenshots of the visible window for remote monitoring.
Goal 1 is working well. However, for Goal 2, I encountered issues. Initially, I used Electron’s DesktopCapturer but found it only supports X11 for screenshots.
Since my app runs on Wayland, I explored alternatives and discovered the ubuntu-frame.screenshot
tool, which uses Grim for taking screenshots.
I successfully captured screenshots by running this command manually on terminal (required sudo).
To integrate this tool with my Electron app, I created a bash script and executed it via Node’s child process. This worked only in --devmode
, which isn’t suitable for publishing.
I attempted to replicate the ubuntu-frame.screenshot
setup in my Snap as my-snap.screenshot
, but it also required --devmode
to function. Interestingly, I had to enable snap set ubuntu-frame config="add-wayland-extensions=zwlr_screencopy_manager_v1"
for my tool, but not for the original (ubuntu-frame.screenshot
). Not sure why
Now, I can take Wayland screenshots, but I’m unsure how to integrate this into my Electron Snap.
I’m considering packaging my screenshot tool as a Debian service to listen for D-Bus messages, and try to send requests from my Electron snap to it, but decided to ask here before proceeding.
Has anyone faced similar issues? Any simpler solutions to integrate Wayland screenshots with Electron would be appreciated!
Thanks for your time!