mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
4e0b43a4ab
@ -1,144 +0,0 @@
|
||||
[#]: subject: "GNOME Screenshot Tool: Old and New Methods"
|
||||
[#]: via: "https://www.debugpoint.com/gnome-screenshot-tool-usage/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpis"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
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.**
|
||||
|
||||
![][1]
|
||||
|
||||
In 2022, GNOME changed its default screenshot tool and built the screenshot function as part of the GNOME Shell. It’s 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][2] onwards, this has been removed. Hence [Ubuntu 22.04][3] 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 keyboard’s 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)][4]
|
||||
|
||||
![GNOME Screenshot main window (old)][5]
|
||||
|
||||
For further customization, you can open Settings and remove the keybinding of Print-Screen from the Shell’s 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][6]. 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][7] videoconferencing calls [broke][8] under GNOME-Wayland due to this, which was eventually solved via the below method of turning off the safe mode.
|
||||
|
||||
Let’s 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][9] to turn off the safe mode.
|
||||
|
||||
Press `ALT+F`2 and type below:
|
||||
|
||||
```
|
||||
lg
|
||||
```
|
||||
|
||||
![Launch looking glass][10]
|
||||
|
||||
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][11]
|
||||
|
||||
You should see a response that it is turned off.
|
||||
|
||||
![Verification][12]
|
||||
|
||||
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][13]
|
||||
|
||||
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. It’s 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][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2023/01/gnome-sc1-1.jpg
|
||||
[2]: https://www.debugpoint.com/gnome-42/
|
||||
[3]: https://www.debugpoint.com/ubuntu-22-04-review/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/GNOME-Screenshot-old.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/GNOME-Screenshot-main-window-old.jpg
|
||||
[6]: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenshot.js#L2210
|
||||
[7]: https://www.debugpoint.com/zoom-install-linux-ubuntu-download/
|
||||
[8]: https://community.zoom.com/t5/Meetings/Wayland-screen-sharing-broken-with-GNOME-41-on-Fedora-35/m-p/22539
|
||||
[9]: https://wiki.gnome.org/Projects/GnomeShell/LookingGlass
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2023/01/Launch-looking-glass.jpg
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Turn-off-safe-mode.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2023/01/Verification.jpg
|
||||
[13]: https://www.debugpoint.com/wp-content/uploads/2023/01/Launch-new-GNOME-Shell-Screenshot-UI-from-CLI.jpg
|
@ -0,0 +1,144 @@
|
||||
[#]: subject: "GNOME Screenshot Tool: Old and New Methods"
|
||||
[#]: via: "https://www.debugpoint.com/gnome-screenshot-tool-usage/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
GNOME 截图工具:旧的和新的方法
|
||||
======
|
||||
|
||||
**以下是关于 GNOME 截图工具的细节,它的用法以及如何用旧的和现代的方法安装和启动它们。**
|
||||
|
||||
![][1]
|
||||
|
||||
2022 年,GNOME 改变了其默认的截图工具,并将截图功能构建为 GNOME Shell 的一部分。它不再是一个独立的应用了。
|
||||
|
||||
早些时候,GNOME 通过所有主要的 Linux 发行版,如 Ubuntu 和 Fedora,提供了一个本地 GTK 应用 gnome-screenshot。然而,从 [GNOME 42][2] 开始,这个功能已经被移除。因此从 [Ubuntu 22.04][3] 和 Fedora 36 开始,你只能得到以下新的截图 UI 作为默认的截图工具。
|
||||
|
||||
这一变化从根本上破坏了许多工作流程。因为它不是一个你可以单独启动的可执行文件,你只能依赖键盘上的 Print-Screen 键。而且只能通过应用搜索获得一个快捷方式。
|
||||
|
||||
因此,在新的 GNOME 截图 UI 中捕捉有延迟的屏幕截图变得更有挑战性。
|
||||
|
||||
下面是一些你仍然可以使用旧的 GNOME 截图工具的方法,以及如何手动触发新的截图 UI。
|
||||
|
||||
### GNOME 截图工具:如何安装旧版 GUI
|
||||
|
||||
如果你使用的是 Ubuntu 22.04 及以上版本,或者任何基于 Ubuntu 的带有 GNOME 桌面的发行版,运行以下命令来安装它。
|
||||
|
||||
```
|
||||
sudo apt install gnome-screenshot
|
||||
```
|
||||
|
||||
而对于 Fedora 用户,使用下面的命令。
|
||||
|
||||
```
|
||||
sudo dnf install gnome-screenshot
|
||||
```
|
||||
|
||||
如果你在 **Arch Linux 或者 Manjaro Linux 中使用 GNOME 桌面**,那么使用下面的命令来安装它。
|
||||
|
||||
```
|
||||
pacman -S gnome-desktop
|
||||
```
|
||||
|
||||
安装后,通过应用程序菜单启动它。
|
||||
|
||||
![GNOME 截图(旧)][4]
|
||||
|
||||
![GNOME 截图主窗口(旧)][5]
|
||||
|
||||
为了进一步定制,你可以打开设置,从 Shell 的新 UI 中移除 Print-Screen 的按键绑定,并通过以下命令创建一个自定义的键盘快捷方式。
|
||||
|
||||
```
|
||||
gnome-screenshot --window <窗口>
|
||||
gnome-screenshot --area <区域>
|
||||
gnome-screenshot <全屏>
|
||||
```
|
||||
|
||||
### GNOME 截图 UI:如何通过命令行手动触发它
|
||||
|
||||
当你从键盘上按下 Print-Screen 键时执行的函数是 [GNOME Shell 代码][6]的一部分。不幸的是,它被保护在 dbus API 内,你不能直接调用它。
|
||||
|
||||
这样做是为了让你在 Wayland 下安全,这样就不会有任意的代码通过任何脚本获得对 dbus 调用函数的访问。
|
||||
|
||||
然而,这破坏了许多使用场景和人们多年来编写的脚本。例如,许多用户报告说 [Zoom][7] 在 GNOME-Wayland 下的视频会议通话[中断][8]就是因为这个原因,最终通过下面这个关闭安全模式的方法解决了这个问题。
|
||||
|
||||
让我们看看如何关闭它并触发 gnome-shell 的截图
|
||||
|
||||
在使用下面的步骤之前,请谨慎行事。因为它可能会开放你的 GNOME Shell,让你任意访问脚本。请确保你知道你在做什么。
|
||||
|
||||
首先,你需要打开 [GNOME looking glass][9] 来关闭安全模式。
|
||||
|
||||
按 `ALT+F2` 并输入以下内容:
|
||||
|
||||
```
|
||||
lg
|
||||
```
|
||||
|
||||
![启动 looking glass][10]
|
||||
|
||||
在顶部选择 Evaluator,在命令窗口中,输入以下内容。然后点击回车。
|
||||
|
||||
```
|
||||
global.context.unsafe_mode = true
|
||||
```
|
||||
|
||||
![关闭安全模式][11]
|
||||
|
||||
你应该看到一个响应,即它已被关闭。
|
||||
|
||||
![验证][12]
|
||||
|
||||
现在按 esc 键关闭 looking glass。并打开一个终端。
|
||||
|
||||
输入以下内容以启动截图工具。
|
||||
|
||||
```
|
||||
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.screenshotUI.open();'
|
||||
```
|
||||
|
||||
你应该看到新的 GNOME Shell 截图被触发了。
|
||||
|
||||
![从 CLI 启动新的 GNOME Shell 截图 UI][13]
|
||||
|
||||
如果你想关闭它,再次打开 `lg` 并将其设置为 false。
|
||||
|
||||
```
|
||||
global.context.unsafe_mode = true
|
||||
```
|
||||
|
||||
### 结束语
|
||||
|
||||
从使用上来说,通过关闭安全模式,你仍然可以通过任何 shell 脚本使用新的截图功能。但不建议这样做。最好是使用旧的 GNOME 截图工具来避免所有的麻烦。
|
||||
|
||||
干杯。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/gnome-screenshot-tool-usage/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2023/01/gnome-sc1-1.jpg
|
||||
[2]: https://www.debugpoint.com/gnome-42/
|
||||
[3]: https://www.debugpoint.com/ubuntu-22-04-review/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/GNOME-Screenshot-old.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/GNOME-Screenshot-main-window-old.jpg
|
||||
[6]: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenshot.js#L2210
|
||||
[7]: https://www.debugpoint.com/zoom-install-linux-ubuntu-download/
|
||||
[8]: https://community.zoom.com/t5/Meetings/Wayland-screen-sharing-broken-with-GNOME-41-on-Fedora-35/m-p/22539
|
||||
[9]: https://wiki.gnome.org/Projects/GnomeShell/LookingGlass
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2023/01/Launch-looking-glass.jpg
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Turn-off-safe-mode.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2023/01/Verification.jpg
|
||||
[13]: https://www.debugpoint.com/wp-content/uploads/2023/01/Launch-new-GNOME-Shell-Screenshot-UI-from-CLI.jpg
|
Loading…
Reference in New Issue
Block a user