diff options
| -rwxr-xr-x | .local/bin/dotfiles | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/.local/bin/dotfiles b/.local/bin/dotfiles index 54a214e..7c0fbf4 100755 --- a/.local/bin/dotfiles +++ b/.local/bin/dotfiles @@ -26,6 +26,32 @@ sync_deps() { fi } +sync_aur() { + local missing_deps=() + for dep; do + if ! pacman --query "$dep" >/dev/null 2>&1; then missing_deps+=("$dep"); fi + done + if [[ ${#missing_deps[@]} -eq 0 ]]; then return; fi + if prompt_for_install "Missing AUR dependencies: ${missing_deps[*]}"; then + yay --sync "${missing_deps[@]}" + fi +} + +disable_kwallet_secret_service() { + # pass-secret-service can only own org.freedesktop.secrets if KWallet + # (KDE's default provider) releases the name. Disable KWallet and its + # Secret Service API. Idempotent: only writes kwalletrc when not already + # off; the pass-secret-service unit itself is D-Bus activated, no enable. + local enabled api + enabled="$(kreadconfig6 --file kwalletrc --group Wallet --key Enabled)" + api="$(kreadconfig6 --file kwalletrc --group "org.freedesktop.secrets" --key apiEnabled)" + if [[ $enabled == false && $api == false ]]; then return; fi + if prompt_for_install "KWallet still owns org.freedesktop.secrets — disable it"; then + kwriteconfig6 --file kwalletrc --group Wallet --key Enabled --type bool false + kwriteconfig6 --file kwalletrc --group "org.freedesktop.secrets" --key apiEnabled --type bool false + fi +} + sync_mdformat() { local pipx_json pipx_json="$(pipx list --json)" @@ -47,9 +73,15 @@ sync_mdformat() { link_browserpass_host() { # Upstream-supported install of the Firefox native messaging host # (symlinks the packaged manifest into ~/.mozilla/native-messaging-hosts/). - # Skips when browserpass isn't installed (pacman prompt declined). + # Skips when browserpass isn't installed (pacman prompt declined), and + # stays silent when the symlink is already correct (the make target is + # `ln -sfv`, idempotent but noisy on every run). [[ -f /usr/lib/browserpass/Makefile ]] || return 0 - make --directory=/usr/lib/browserpass hosts-firefox-user + local host=com.github.browserpass.native.json + local src=/usr/lib/browserpass/hosts/firefox/$host + local dest="$HOME/.mozilla/native-messaging-hosts/$host" + if [[ "$dest" -ef "$src" ]]; then return; fi + make --no-print-directory --directory=/usr/lib/browserpass hosts-firefox-user } build_and_install_nvim() { @@ -106,8 +138,10 @@ sync) wl-clipboard # Wayland clipboard jq # JSON processor pass # password manager + firefox # web browser browserpass # pass native host for browsers fuzzel # dmenu-compatible menu (for passmenu) + yay # AUR helper (for pass-secret-service-bin) shfmt # shell program formatter stylua # Lua formatter base-devel cmake ninja git # nvim build dependencies @@ -118,6 +152,8 @@ sync) vim-language-server ) sync_deps "${deps[@]}" + sync_aur pass-secret-service-bin + disable_kwallet_secret_service link_browserpass_host sync_nvim sync_mdformat |
