aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'ssh')
-rw-r--r--ssh/.config/profile.d/99-ssh-open.sh5
-rwxr-xr-xssh/.local/bin/ssh-open8
2 files changed, 13 insertions, 0 deletions
diff --git a/ssh/.config/profile.d/99-ssh-open.sh b/ssh/.config/profile.d/99-ssh-open.sh
new file mode 100644
index 0000000..77ac11f
--- /dev/null
+++ b/ssh/.config/profile.d/99-ssh-open.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CLIENT" ]; then
+ export BROWSER="ssh-open"
+fi
diff --git a/ssh/.local/bin/ssh-open b/ssh/.local/bin/ssh-open
new file mode 100755
index 0000000..276360c
--- /dev/null
+++ b/ssh/.local/bin/ssh-open
@@ -0,0 +1,8 @@
+#!/usr/bin/sh
+
+HOSTNAME=$(uname -n)
+
+printf '%s' "$1" | sed \
+ -e "s/localhost/$HOSTNAME/" \
+ -e "s/127\(\.[0-9]\{1,3\}\)\{3\}/$HOSTNAME/" |
+ xargs -I{} ssh -l "$USER" -p 2222 localhost "xdg-open '{}'"