Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6186

Remove popup and sound when taking a screenshot in gnome extension

$
0
0

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:

enter image description here

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


Viewing all articles
Browse latest Browse all 6186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>