diff options
Diffstat (limited to 'ssf')
-rwxr-xr-x | ssf | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -15,6 +15,8 @@ use warnings; my @hosts; my %aliases; +my $remote_user = $ENV{SSF_REMOTE_USER} || $ENV{USER}; + open(my $ssh_config, '<', "$ENV{HOME}/.ssh/config") or die "nope"; while (my $line = <$ssh_config>) { if ($line =~ /^Host ([^#\n]+)(?: # (.*))?$/) { @@ -70,9 +72,9 @@ if (exists $ENV{TMUX}) { # The window does not exist; make the connection in the current one # and it to the machine we're connecting to `tmux rename-window $hostname`; - system 'ssh', '-t', $host, "sh -c \"tmux new -As $ENV{USER}\""; + system 'ssh', '-t', $host, "sh -c \"tmux new -As $remote_user\""; `tmux rename-window '!$hostname'`; } } else { - exec 'ssh', '-t', $host, "sh -c \"tmux new -As $ENV{USER}\""; + exec 'ssh', '-t', $host, "sh -c \"tmux new -As $remote_user\""; } |