diff --git a/home/.chezmoiexternal.yaml b/home/.chezmoiexternal.yaml index b1da442..faff8c0 100644 --- a/home/.chezmoiexternal.yaml +++ b/home/.chezmoiexternal.yaml @@ -117,15 +117,6 @@ type: file {{ $codeNautilusRevision := includeTemplate "get-github-head-revision" (list "harry-cpp/code-nautilus" $cache) }} url: "https://raw.githubusercontent.com/harry-cpp/code-nautilus/{{ $codeNautilusRevision }}/code-nautilus.py" - -{{ if not .is_wsl -}} -".local/bin/gnome-shell-extension-installer": - type: file - {{ $gnomeExtInstallerRevision := includeTemplate "get-github-head-revision" (list "brunelli/gnome-shell-extension-installer" $cache) }} - url: "https://raw.githubusercontent.com/brunelli/gnome-shell-extension-installer/{{ $gnomeExtInstallerRevision }}/gnome-shell-extension-installer" - executable: true -{{- end }} - {{- end }} ".local/bin/skopeo": diff --git a/home/.chezmoiremove b/home/.chezmoiremove index ce79447..2f00119 100644 --- a/home/.chezmoiremove +++ b/home/.chezmoiremove @@ -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/clipboard-indicator@tudmotu.com .docker/cli-plugins/docker-compose .docker/cli-plugins/docker-buildx diff --git a/home/.chezmoiscripts/run_after_81-install-gnome-extensions.sh.tmpl b/home/.chezmoiscripts/run_after_81-install-gnome-extensions.sh.tmpl index fe49c76..a95dc7a 100644 --- a/home/.chezmoiscripts/run_after_81-install-gnome-extensions.sh.tmpl +++ b/home/.chezmoiscripts/run_after_81-install-gnome-extensions.sh.tmpl @@ -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=( + dash-to-panel@jderose9.github.com + arcmenu@arcmenu.com + # {{ if semverCompare "<22.04" .chezmoi.osRelease.versionID }} + # Ubuntu 22.04+ comes with a nice (already dark) default shell theme + user-theme@gnome-shell-extensions.gcampax.github.com + # {{ end }} +) + +unwanted_extensions=( + clipboard-indicator@tudmotu.com + # {{ if semverCompare "<22.04" .chezmoi.osRelease.versionID }} + user-theme@gnome-shell-extensions.gcampax.github.com + # {{ end }} +) -extension_codes["user-theme@gnome-shell-extensions.gcampax.github.com"]=19 -extension_codes["dash-to-panel@jderose9.github.com"]=1160 -extension_codes["arcmenu@arcmenu.com"]=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 diff --git a/home/.chezmoiscripts/run_after_82-configure-gnome.sh.tmpl b/home/.chezmoiscripts/run_after_82-configure-gnome.sh.tmpl index 0627199..0432028 100644 --- a/home/.chezmoiscripts/run_after_82-configure-gnome.sh.tmpl +++ b/home/.chezmoiscripts/run_after_82-configure-gnome.sh.tmpl @@ -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" user-theme@gnome-shell-extensions.gcampax.github.com +# {{ end }} # {{ end }} # Configuring miscellaneous settings diff --git a/home/dot_local/bin/executable_full-upgrade.tmpl b/home/dot_local/bin/executable_full-upgrade.tmpl index 75fafa6..0e46c60 100644 --- a/home/dot_local/bin/executable_full-upgrade.tmpl +++ b/home/dot_local/bin/executable_full-upgrade.tmpl @@ -56,9 +56,9 @@ if flatpak --version &>/dev/null; then c sudo flatpak update --assumeyes fi -if command -v gnome-shell-extension-installer >/dev/null; then +if gext --version >/dev/null; then log_task "Updating gnome extensions" - c gnome-shell-extension-installer --update --yes + c gext update --yes --user fi if pipx --version >/dev/null; then diff --git a/root/.chezmoiscripts/run_after_10-install-apt-packages.sh.tmpl b/root/.chezmoiscripts/run_after_10-install-apt-packages.sh.tmpl index c14dc65..84d2639 100644 --- a/root/.chezmoiscripts/run_after_10-install-apt-packages.sh.tmpl +++ b/root/.chezmoiscripts/run_after_10-install-apt-packages.sh.tmpl @@ -42,6 +42,7 @@ readonly wanted_packages=( code google-chrome-stable python3-nautilus + pipx # {{ if not .is_wsl }} yaru-theme-gnome-shell libsecret-1-0