从终端安装 GNOME Shell 扩展

从终端安装 GNOME Shell 扩展

有没有办法从终端安装 GNOME 扩展,例如 dash to dock?我现在的做法是进入 Ubuntu 软件应用商店并安装它。

答案1

Dash to Dock GNOME 扩展

如图所示https://extensions.gnome.org/extension/307/dash-to-dock/

在此处下载 .zip 文件https://micheleg.github.io/dash-to-dock/releases.html

注意:下载的 .zip 文件的名称可能与下面显示的解压缩命令中显示的名称不同[email protected]。根据需要调整命令以获取正确的 .zip 名称。

请参阅此处的手动安装说明https://micheleg.github.io/dash-to-dock/download.html

手动安装

您还可以从发布页面以 zip 存档的形式获取扩展。查找支持您的 shell 版本的最新版本。可以通过 来安装扩展gnome-tweak-tool,或者也可以通过内部directly extracting the archive in the a directory named [email protected]~/.local/share/gnome-shell/extensions/

unzip [email protected] \ -d ~/.local/share/gnome-shell/extensions/[email protected]/

需要重新加载 Shell Alt+F2 r Enter。可以使用 启用扩展gnome-tweak-tool,或者通过 dconf 将其添加[email protected]/org/gnome/shell/enabled-extensions键中。

注意:DtD 与 19.04 不兼容。

  • 有传言称,如果你卸载Ubuntu Dock,DtD 将与 19.04 兼容

  • 似乎手动安装 DtD 也可以在 19.04 中实现此功能

答案2

您可以通过运行以下命令来安装 Dash-to-Dock:

sudo apt install gnome-shell-extension-dashtodock

apt search gnome-shell-extension例如,您可以通过运行获取可用扩展的列表。

答案3

我刚刚发现了两种从终端安装的方法。就我个人而言,我更喜欢 python 打包工具,因为它很简单,但第二种方法可能会让您对安装过程进行更细粒度的控制。

A)使用python包

# 1. Install the package
pip3 install gnome-extensions-cli

# 2. Install extension by UUID
gnome-extensions-cli install [email protected]
# 2.a ... or by PK (primary key)
gnome-extensions-cli install 307

github 页面上的更多信息:https://github.com/essembeh/gnome-extensions-cli或使用gnome-extensions-cli --help

如果没有活动的 gnome shell 会话,该工具将会报错。要修复,请使用--backend file

B)使用自定义 shell 脚本

#!/usr/bin/env bash

[email protected]
pk=307

# 1. GNOME shell version
shell_version=$(gnome-shell --version | cut -d' ' -f3)

# 2. Fetch extension info (for the given shell version)
info_json=$(curl -sS "https://extensions.gnome.org/extension-info/?uuid=$uuid&shell_version=$shell_version")
# 2.a instead of ?uuid=$uuid you can use ?pk=$pk

# 3. Extract download url from the json with jq
download_url=$(echo $info_json | jq ".download_url" --raw-output)

# 4. Install the extension
gnome-extensions install "https://extensions.gnome.org$download_url"
# 4.a ... or download it first, then install
curl -sL "https://extensions.gnome.org$download_url" -o $uuid.zip
gnome-extensions install $uuid.zip
# 4.a.i ... or manually extract the zip
mkdir -p ~/.local/share/gnome-shell/extensions/$uuid
unzip $uuid.zip -d ~/.local/share/gnome-shell/extensions/$uuid

gnome-extensions除了使用GNOME Shell 附带的实用程序外,这与 python 包的功能大致相同。

JQ 是一个命令行 json 处理器——更多用法:https://stedolan.github.io/jq/

相关内容