從終端機安裝 GNOME Shell 擴展

從終端機安裝 GNOME Shell 擴展

有沒有辦法從終端機安裝 GNOME 擴展,例如 dash to dock?我現在的方法是進入 Ubuntu Software 應用程式商店並安裝它。

答案1

Dash 到 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]/

需要重新加載外殼Alt+F2 r Enter。可以使用gnome-tweak-tool或透過新增至金鑰[email protected]來使用 dconf 來啟用擴充/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

這或多或少與 python 套件相同 - 除了使用gnome-extensionsGNOME Shell 附帶的實用程式之外。

JQ 是命令列 json 處理器 - 更多用法:https://stedolan.github.io/jq/

相關內容