diff --git a/.gitignore b/.gitignore index fac905b..76395ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # Ignore bash environment variables. /config/bash/env +# Personal espanso triggers (name, email), seeded per-machine by setup-identity. +/config/dot/espanso/match/identity.yml # Ignore backups of old config files /config/old # Ignore Wireguard config of course! diff --git a/config/dot/espanso/match/base.yml b/config/dot/espanso/match/base.yml index 24a473e..6c4d2ba 100644 --- a/config/dot/espanso/match/base.yml +++ b/config/dot/espanso/match/base.yml @@ -1,17 +1,9 @@ # espanso match file # https://espanso.org/docs/ +# Name and email triggers (:fn, :em, ...) are NOT here: they are personal, and +# this file is shared. setup-identity seeds them into match/identity.yml -- +# per-machine, gitignored, yours to edit -- from the install interview. matches: - # Name - - trigger: ":fn" - replace: "Gabriel Brown" - - trigger: ":fin" - replace: "Gabriel A Brown" - # Email - - trigger: ":em" - replace: "gib@gibbyb.com" - - trigger: ":empro" - replace: "me@gbrown.org" - # Date - trigger: ":date" replace: "{{mydate}}" diff --git a/setup/scripts/setup-identity b/setup/scripts/setup-identity index a54656c..d92af07 100755 --- a/setup/scripts/setup-identity +++ b/setup/scripts/setup-identity @@ -41,6 +41,26 @@ git config --global alias.st status git config --global pull.rebase true log "git aliases and pull.rebase applied" +# Text-expansion identity. The :fn/:em triggers used to hardcode the repository +# owner's name and email in the shared match file; each machine now writes its +# own from the interview's answers. Per-machine and gitignored -- espanso loads +# every file under match/, so it sits beside base.yml without being shared. +# Kept when it already exists: the file is the user's to edit, and a re-run +# must not erase what they added. +espanso_identity="${XDG_CONFIG_HOME:-$HOME/.config}/espanso/match/identity.yml" +if [[ -d "$(dirname "$espanso_identity")" && ! -e "$espanso_identity" ]] \ + && [[ -n "$git_name" || -n "$git_email" ]]; then + { + printf '# Personal expansion triggers, seeded from the install interview.\n' + printf '# Per-machine and untracked: add your own freely.\n' + printf 'matches:\n' + [[ -n "$git_name" ]] && printf ' - trigger: ":fn"\n replace: "%s"\n' "$git_name" + [[ -n "$git_email" ]] && printf ' - trigger: ":em"\n replace: "%s"\n' "$git_email" + : + } > "$espanso_identity" + log "Seeded espanso identity triggers at $espanso_identity" +fi + if [[ "${PANAMA_GH_LOGIN:-no}" == yes ]]; then if command -v gh >/dev/null 2>&1; then log "Signing in to GitHub"