From 9d05b2900052f3c8ce9e7f4195680ad32a45f1b8 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 4 Nov 2018 16:19:32 -0500 Subject: [PATCH] Add ssh-helper command --- skel/.i3/run.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/skel/.i3/run.sh b/skel/.i3/run.sh index f727148..2aa9dbe 100755 --- a/skel/.i3/run.sh +++ b/skel/.i3/run.sh @@ -175,10 +175,16 @@ if [ "$ARG" = "clip" ]; then fi fi if [ "$ARG" = "ssh_helper" ]; then - if command -v iwgetid >/dev/null; then + if [ -f /proc/net/wireless ]; then + WIRELESS_DEV="$(perl -ne 'print if s/(\w+):.*/\1/' /dev/null; then SSID="$(iwgetid wlan0 -r)" elif command -v nmcli >/dev/null; then SSID="$(nmcli -t -f active,ssid dev wifi | perl -ne 'print if s/yes://;')" + elif command -v termux-wifi-connectioninfo >/dev/null; then + # Android device (termux) + SSID="$(termux-wifi-connectioninfo | perl -ne 'print if s/^\s*"ssid": "(.+)",$/\1/')" fi case "$(hostname)" in sgen|egen|runner2) @@ -188,10 +194,12 @@ if [ "$ARG" = "ssh_helper" ]; then logger "Found SSID for $(hostname): $SSID" case "$SSID" in ATTskUYuI2) - ssh -q -W "${1}" "${2}@192.168.1.200" + logger "ssh -q -W ${1} 192.168.1.200" + ssh -q -W "${1}" 192.168.1.200 ;; *) - ssh -q -W "${1}" -p 23 "${2}@austenwares.com" + logger "ssh -q -W ${1} -p 23 austenwares.com" + ssh -q -W "${1}" -p 23 austenwares.com ;; esac fi