aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/zsh/wsl.zsh
blob: 5a8c10f8e6e085cb00b284be061e81e8a7e97887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export PATH="${HOME}/.local/bin.win:$PATH"
hash -d w=/mnt/c/Users/$USER
alias cb=clip.exe

function winget() {
  if [[ "$1" == "install" || "$1" == "upgrade" ]]; then
    powershell.exe -NoProfile -c "gsudo.exe 'winget.exe $@'"
  else
    powershell.exe -NoProfile -c "winget.exe $@"
  fi
}

function wt() {
  powershell.exe -NoProfile -c "wt.exe $@"
}

# YubiKey - SSH
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
ss -a | grep -q $SSH_AUTH_SOCK
if [ $? -ne 0 ]; then
  rm -f $SSH_AUTH_SOCK
  (setsid nohup socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:$HOME/.ssh/wsl2-ssh-pageant.exe >/dev/null 2>&1 &)
fi

# YubiKey - GPG
export GPG_AGENT_SOCK=$HOME/.gnupg/S.gpg-agent
ss -a | grep -q $GPG_AGENT_SOCK
if [ $? -ne 0 ]; then
  rm -rf $GPG_AGENT_SOCK
  (setsid nohup socat UNIX-LISTEN:$GPG_AGENT_SOCK,fork EXEC:"$HOME/.ssh/wsl2-ssh-pageant.exe --gpg S.gpg-agent" >/dev/null 2>&1 &)
fi