commit 252aab6f372968e80a80596ca6b4df1cfc8f3425
parent c3701a02ae1f96eacb025c8a300f33e10536bab9
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 2 Oct 2020 10:49:43 +0200
Merge branch 'master' of src.adamsgaard.dk:dotfiles into master
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/.local/bin/ssh-proxy b/.local/bin/ssh-proxy
@@ -0,0 +1,2 @@
+#!/bin/sh
+ssh -D 1337 -C -N adamsgaard.dk
diff --git a/.local/bin/surf-open.sh b/.local/bin/surf-open.sh
@@ -13,11 +13,12 @@ if command -v surf-clean-cookies >/dev/null 2>&1; then
fi
screen_resolution() {
- xrandr -q | grep -v eDP-1 | awk '
+ xrandr -q | awk '
{
- if (printline) { gsub(/x.*/,"", $0); print $1; exit }
+ if (printline) { gsub(/x.*/,"", $0); printline=0; res=$1 }
if (match($0, / connected/)) { printline=1 }
- }'
+ }
+ END { print res }'
}
runtabbed() {
echo "starting tabbed"
@@ -34,8 +35,14 @@ opensurf() {
[ ! -r "$xidfile" ] && runtabbed
+proxyport="$(ps x | grep '[s]sh -D ' | sed 's,.*-D ,,; s, .*,,')"
+if [ -n "$proxyport" ]; then
+ export http_proxy="socks://localhost:${proxyport}"
+fi
+
xid=$(cat "$xidfile")
if ! xprop -id "$xid" >/dev/null 2>&1; then
runtabbed
fi
+printf '%s: %s\n' "$xidfile" "$xid"
opensurf