From 5f68d97340ce2a9c1c131d3ad80876a886d34211 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Wed, 31 Jan 2024 15:13:30 -0600 Subject: fix(ssh): simplify socket remote forwarding --- tmux/.local/bin/tmux-sshr | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'tmux/.local/bin/tmux-sshr') diff --git a/tmux/.local/bin/tmux-sshr b/tmux/.local/bin/tmux-sshr index c761a15..e261278 100755 --- a/tmux/.local/bin/tmux-sshr +++ b/tmux/.local/bin/tmux-sshr @@ -27,22 +27,20 @@ if [ "$target" = "$HOST" ]; then else if ! tmux -L ssh has-session -t "$target"; then tmux_sock=$(tmux -L ssh start-server \; display -p "#{socket_path}") - runtime=$( - ssh -T \ + read -r runtime <<-EOF + $(ssh -T \ -o "ControlMaster=auto" \ -o "ControlPath=${XDG_RUNTIME_DIR}/ssh.%C" \ "$target" \ - 'printf "%s\n" "$XDG_RUNTIME_DIR"' - ) + 'printf "%s\n" "$XDG_RUNTIME_DIR"') + EOF - tmux -L ssh new-session -ds "$target" \ - ssh -t \ - -o "ControlMaster=auto" \ - -o "ControlPath=${XDG_RUNTIME_DIR}/ssh.%C" \ + tmux -L ssh new-session -ds "$target" -- ssh -t \ -R "2222:localhost:22" \ - -R "${runtime}/xdg-open.socket:${XDG_RUNTIME_DIR}/xdg-open.socket" \ -R "${runtime}/tmux.${HOST}.control:${tmux_sock}" \ - "$target" "zsh -l -c 'tmux -S \${XDG_RUNTIME_DIR}/tmux.${HOST} new -A'" + -R "${runtime}/xdg-open.socket:${XDG_RUNTIME_DIR}/xdg-open.socket" \ + -R "${runtime}/discord-ipc-0:${XDG_RUNTIME_DIR}/discord-ipc-0" \ + "$target" "zsh -l -c 'tmux -S ${runtime}/tmux.${HOST} new -A'" fi if [ -z "$TMUX" ]; then -- cgit v1.2.3-70-g09d2