]> git.sev.monster Git - dotfiles.git/blobdiff - etc/zsh/.zprofile
zshenv: better perl setup, dont require local::lib
[dotfiles.git] / etc / zsh / .zprofile
index 407c3009fe16e637e6c0fc9ec0f5c108f3720d4a..170f4de957381725506604436f8cc46078b5d547 100644 (file)
@@ -71,7 +71,7 @@ if [[ ! -v DBUS_SESSION_BUS_ADDRESS && -v commands[dbus-launch] ]] {
 #       clunky (e.g. asking for password twice) to make it worth it.
 function _gpg_socketpath {
     # dirs are percent-encoded: https://stackoverflow.com/a/64312099
-    echo ${1//(#b)%([[:xdigit:]](#c2))/${(#):-0x$match[1]}}
+    echo -E - ${1//(#b)%([[:xdigit:]](#c2))/${(#):-0x$match[1]}}
 }
 if [[ ! -v _sev_setup_gpg_forward && -v commands[gpg] ]] {
     # XXX: assuming /tmp exists and is writable on destination
@@ -143,18 +143,15 @@ if [[ -v commands[gpg-connect-agent] &&
                 export GPG_TTY=$(tty)
             if [[ ( -v DISPLAY || -v WAYLAND_DISPLAY ) &&
                   ${PINENTRY_USER_DATA/USE_TTY=0} == $PINENTRY_USER_DATA ]]
-                export PINENTRY_USER_DATA=USE_TTY=$((
-                  ${+DISPLAY} + ${+WAYLAND_DISPLAY} == 0))
-            # XXX: don't know if gpg-agent supports comments after directives
-            # XXX: path could have #
+                export PINENTRY_USER_DATA=USE_TTY=0
             # XXX: we are assuming this is our pinentry from .local/bin
-            sed -Ei 's#^([[:space:]]*pinentry-program[[:space:]]).*$#\1'$HOME'/.local/bin/pinentry#' \
+            sed -Ei 's\1f^([[:space:]]*pinentry-program[[:space:]]).*$\1f\1'$HOME'/.local/bin/pinentry\1f' \
               ${GNUPGHOME:-~/.gnupg}/gpg-agent.conf 2>/dev/null
             # XXX: could check for changes before doing this to save perf
             gpg-connect-agent RELOADAGENT UPDATESTARTUPTTY /bye >/dev/null 2>&1
             if {$p} {
                 gpg-connect-agent /subst /serverpid \
-                  "/echo pid \${get serverpid} on $GPG_TTY" /bye 2>/dev/null
+                  "/echo pid \${get serverpid} on ${WAYLAND_DISPLAY:-${DISPLAY:-$GPG_TTY}}" /bye 2>/dev/null
                 print -nP '%f'
             }
         } elif {$p} {
@@ -191,12 +188,13 @@ if [[ ! -v _sev_setup_ssh ]] {
             #      subshells can't be used to capture output and print.
             c='TMPDIR=$_sev_tmp ${okc}ssh-agent'
             if [[ -o interactive ]] {
+                [[ -n $okc ]] && echo -n 'OKC-'
                 eval $(eval $=c)
                 print -nP '%f'
             } else {
                 eval $(eval $=c) >/dev/null 2>&1
             }
-            echo -n $SSH_AUTH_SOCK$'\0'$SSH_AGENT_PID >!$e
+            echo -En - $SSH_AUTH_SOCK$'\0'$SSH_AGENT_PID >!$e
             unset c
         fi
         unset okc e sock pid
This page took 0.0381629999999999 seconds and 4 git commands to generate.