-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use gnome-extensions-cli instead of gnome-shell-extension-installer
Closes #100
- Loading branch information
Showing
6 changed files
with
62 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,13 @@ | |
# use werf helm upgrade --wait instead | ||
.local/bin/helm-upgrade-logs | ||
|
||
# now we use gext instead | ||
.local/bin/gnome-shell-extension-installer | ||
|
||
# tea got renamed to pkgx | ||
.local/bin/tea | ||
.tea | ||
|
||
.local/share/gnome-shell/extensions/[email protected] | ||
.docker/cli-plugins/docker-compose | ||
.docker/cli-plugins/docker-buildx | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,50 +10,71 @@ ensure_path_entry "${HOME}/.local/bin" | |
function is_gnome_extension_installed() { | ||
local extension="$1" | ||
|
||
if [[ -d "${HOME}/.local/share/gnome-shell/extensions/${extension}" ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
gext list --all | grep --quiet "(${extension})" | ||
} | ||
|
||
function enable_extension() { | ||
function is_gnome_extension_enabled() { | ||
local extension="$1" | ||
|
||
local current_enabled_extensions | ||
current_enabled_extensions="$(gsettings get org.gnome.shell enabled-extensions)" | ||
|
||
if [[ "${current_enabled_extensions}" != *"'${extension}'"* ]]; then | ||
log_task "Enabling GNOME extension: ${extension}" | ||
if [[ "${current_enabled_extensions}" == *"[]"* ]]; then | ||
new_enabled_extensions="['${extension}']" | ||
else | ||
new_enabled_extensions="${current_enabled_extensions%]*}, '${extension}']" | ||
fi | ||
gsettings set org.gnome.shell enabled-extensions "${new_enabled_extensions}" | ||
fi | ||
gext list | grep --quiet "(${extension})" | ||
} | ||
|
||
declare -A extension_codes | ||
wanted_extensions=( | ||
[email protected] | ||
[email protected] | ||
# {{ if semverCompare "<22.04" .chezmoi.osRelease.versionID }} | ||
# Ubuntu 22.04+ comes with a nice (already dark) default shell theme | ||
[email protected] | ||
# {{ end }} | ||
) | ||
|
||
unwanted_extensions=( | ||
[email protected] | ||
# {{ if semverCompare "<22.04" .chezmoi.osRelease.versionID }} | ||
[email protected] | ||
# {{ end }} | ||
) | ||
|
||
extension_codes["[email protected]"]=19 | ||
extension_codes["[email protected].com"]=1160 | ||
extension_codes["[email protected]"]=3628 | ||
disabled_extensions=( | ||
ubuntu-dock@ubuntu.com | ||
) | ||
|
||
missing_extensions=() | ||
|
||
for extension in "${!extension_codes[@]}"; do | ||
enable_extension "${extension}" | ||
if ! command -v gext >/dev/null; then | ||
log_task "Installing gnome-extensions-cli" | ||
c pipx install gnome-extensions-cli | ||
fi | ||
|
||
for extension in "${wanted_extensions[@]}"; do | ||
# shellcheck disable=SC2310 | ||
if ! is_gnome_extension_installed "${extension}"; then | ||
missing_extensions+=("${extension_codes["${extension}"]}") | ||
missing_extensions+=("${extension}") | ||
fi | ||
done | ||
|
||
if [[ ${#missing_extensions[@]} -gt 0 ]]; then | ||
log_task "Installing GNOME extensions" | ||
extra_args=() | ||
if [[ -n "${DISPLAY:-}" ]]; then | ||
extra_args=("--restart-shell") | ||
fi | ||
gnome-shell-extension-installer --yes "${extra_args[@]}" "${missing_extensions[@]}" | ||
gext install "${missing_extensions[@]}" | ||
fi | ||
|
||
for extension in "${disabled_extensions[@]}"; do | ||
if is_gnome_extension_enabled "${extension}"; then | ||
log_task "Disabling GNOME extension: ${extension}" | ||
gext disable "${extension}" | ||
fi | ||
done | ||
|
||
for extension in "${wanted_extensions[@]}"; do | ||
if ! is_gnome_extension_enabled "${extension}"; then | ||
log_task "Enabling GNOME extension: ${extension}" | ||
gext enable "${extension}" | ||
fi | ||
done | ||
|
||
for extension in "${unwanted_extensions[@]}"; do | ||
if is_gnome_extension_installed "${extension}"; then | ||
log_task "Uninstalling GNOME extension: ${extension}" | ||
gext uninstall "${extension}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,12 @@ gsettings_ensure org.gnome.desktop.interface gtk-theme "Yaru-dark" | |
gsettings_ensure org.gnome.desktop.interface icon-theme "Yaru" | ||
gsettings_ensure org.gnome.desktop.interface cursor-theme "Yaru" | ||
gsettings_ensure org.gnome.desktop.sound theme-name "Yaru" | ||
# {{ if not .is_wsl }} | ||
# {{ if semverCompare ">=22.04" .chezmoi.osRelease.versionID }} | ||
gsettings_ensure org.gnome.desktop.interface color-scheme "prefer-dark" | ||
# {{ else }} | ||
# {{ if not .is_wsl }} | ||
gsettings_ensure org.gnome.shell.extensions.user-theme name "Yaru-dark" [email protected] | ||
# {{ end }} | ||
# {{ end }} | ||
|
||
# Configuring miscellaneous settings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters