]> git.sev.monster Git - dotfiles.git/blobdiff - etc/zsh/.zprofile
librewolf: allow different extension enablement
[dotfiles.git] / etc / zsh / .zprofile
index a55b7e6e9ce6f2ef3d4782042255f602f679bfe1..58ebfa1fba81381e8fae2813792eeb14f644244d 100644 (file)
@@ -50,8 +50,9 @@ if [[ ! -v DBUS_SESSION_BUS_ADDRESS && -v commands[dbus-launch] ]] {
 #       therefore, the safest way to ensure unique sockets while not having to
 #       write specific logic for both scenarios is to simply change GNUPGHOME.
 #       the easiest way to do this is to create a new dir and link the contents
-#       of GNUPGHOME to the new home. we can then replace the agent sockets
-#       there with the forwarded one.
+#       of GNUPGHOME to the new home. we can then replace all of the agent
+#       sockets wherever they now are with the forwarded one. in either case we
+#       will be overwriting the session-specific sockets.
 #
 # NOTE: since Unix sockets are not supported under Windows, this will not work
 #       under msys, cygwin, mingw, etc., but may work under wsl2.
@@ -142,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} {
@@ -179,7 +177,7 @@ if [[ ! -v _sev_setup_ssh ]] {
         if [[ -f $e ]] {
             IFS=$'\0' read -r sock pid <$e
         }
-        if [[ -S $sock && $pid > 0 ]] && kill -0 $pid; then
+        if [[ -S $sock && $pid > 0 ]] && kill -0 $pid >/dev/null 2>&1; then
             [[ -o interactive ]] && print -P "Reusing agent PID $pid%f"
             export SSH_AUTH_SOCK=$sock
             export SSH_AGENT_PID=$pid
This page took 0.034436 seconds and 4 git commands to generate.