TranslateProject/sources/tech/20230119.1 ⭐️ GNOME Screenshot Tool Old and New Methods.md

5.7 KiB
Raw Blame History

GNOME Screenshot Tool: Old and New Methods

Here are the details about the GNOME Screenshot tool, its usage and how to install and launch them in older and modern methods.

In 2022, GNOME changed its default screenshot tool and built the screenshot function as part of the GNOME Shell. Its not a separate application anymore.

Earlier, GNOME featured a native GTK app gnome-screenshot via all the major Linux distributions such as Ubuntu and Fedora. However, from GNOME 42 onwards, this has been removed. Hence Ubuntu 22.04 and Fedora 36 onwards, you only get the following new screenshot UI as a default screenshot utility.

This change fundamentally broke many workflows. Since it is not an executable you can launch separately, you only depend on the keyboards print-screen key. And only a shortcut is available via application search.

Hence, capturing screenshots with a delay in the new GNOME screenshot UI becomes much more challenging.

Here are some of the ways you can still use the older GNOME Screenshot tool and how to trigger the new screenshot UI manually.

GNOME Screenshot Tool: How to install the old GUI

If you are using Ubuntu 22.04 and above, or any Ubuntu-based distribution with a GNOME desktop, run the following command to install it.

sudo apt install gnome-screenshot

And for Fedora users, use the following command.

sudo dnf install gnome-screenshot

If you are using a GNOME desktop in Arch Linux or Manjaro Linux GNOME, then use the below command to install it.

pacman -S gnome-desktop

After installation, launch it via the application menu.

GNOME Screenshot (old)

GNOME Screenshot main window (old)

For further customization, you can open Settings and remove the keybinding of Print-Screen from the Shells new UI and create a custom keyboard shortcut with the following commands.

gnome-screenshot --window   <for window>
gnome-screenshot --area     <for area>
gnome-screenshot            <for fullscreen>

GNOME Screenshot UI: How to manually trigger it via the command line

The function which executes when you press the Print-Screen key from the keyboard is part of the GNOME Shell code. Unfortunately, it is protected inside dbus API, and you can not invoke it directly.

It has been done to make you safe under Wayland so that no arbitrary code gets access to dbus call functions via any script.

However, this broke many use cases and scripts which people wrote over the years. For example, many users reported Zoom videoconferencing calls broke under GNOME-Wayland due to this, which was eventually solved via the below method of turning off the safe mode.

Lets see how you can turn it off and trigger the gnome-shell screenshot

Use caution before using the following steps. Since it may open up your GNOME Shell for arbitrary script access. Make sure you know what you are doing.

First, you need to open GNOME looking glass to turn off the safe mode.

Press ALT+F2 and type below:

lg

Launch looking glass

Select Evaluator at the top, and in the command window, type the following. And hit enter.

global.context.unsafe_mode = true

Turn off safe mode

You should see a response that it is turned off.

Verification

Now press escape to close the looking glass. And open a terminal prompt.

And type the following to launch the screenshot tool.

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.screenshotUI.open();'

You should see the new GNOME Shell screenshot triggered.

Launch new GNOME Shell Screenshot UI from CLI

If you want to turn it off, open lg again and set it to false.

global.context.unsafe_mode = true

Closing Notes

Usage-wise, you can still use the new screenshot feature via any shell script by turning off the safe mode. But it is not recommended. Its always better to use the old GNOME Screenshot tool to avoid all the hassles.

Cheers.


via: https://www.debugpoint.com/gnome-screenshot-tool-usage/

作者:Arindam 选题:lkxed 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出