When a screenshot is taken in the gnome extension via the captureScreenshot function, a window pops up and the typical sound of taking a photo is played.
extension.js:
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';import * as Screenshot from 'resource:///org/gnome/shell/ui/screenshot.js';import Shell from 'gi://Shell';export default class ExampleExtension extends Extension {async enable() { const shooter = new Shell.Screenshot(); const [content] = await shooter.screenshot_stage_to_content(); const texture = content.get_texture(); await Screenshot.captureScreenshot(texture, null, 1, null);}disable() {}}
pop-up window:
How to take a screenshot quietly, without pop-ups and sounds? How this is done, for example, when an external application takes a screenshot via the dbus API https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/blob/main/data/org.gnome.Shell.Screenshot.xml#L46. In this case, the screenshot is simply quietly added to the disk and that’s it.
Ubuntu 24.04, GNOME 46, wayland