dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit acf57329763393f7b3b8e8bdc7bb7f06e63756e7
parent cfae646af5982577f069f46bca45b656a4fa2936
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue,  5 Mar 2019 09:13:37 +0100

Fix surf-open

Diffstat:
Mlinks/bin/surf-open.sh | 30+++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/links/bin/surf-open.sh b/links/bin/surf-open.sh @@ -1,7 +1,4 @@ -#!/bin/sh -# -# See the LICENSE file for copyright and license details. -# +#!/usr/bin/env bash #prefix="" #prefix="torsocks" @@ -9,26 +6,21 @@ prefix="firejail" xidfile="/tmp/tabbed-surf-$(whoami).xid" uri="" +[ "$#" -gt 0 ] && uri="$1" + runtabbed() { + echo "starting tabbed" tabbed -dn tabbed-surf -r 2 >"$xidfile" 2>/dev/null & + sleep 0.1 +} +opensurf() { + $prefix surf -e "$xid" "$uri" >/dev/null 2>&1 & } -if [ "$#" -gt 0 ]; then - uri="$1" - if [[ "$1" = "new" ]]; then - uri="$2" - runtabbed - exit - fi -fi - -if [ ! -r "$xidfile" ]; then - runtabbed -fi +[ ! -r "$xidfile" ] && runtabbed xid=$(cat "$xidfile") -xprop -id "$xid" >/dev/null 2>&1 -if [ $? -gt 0 ]; then +if ! xprop -id "$xid" >/dev/null 2>&1; then runtabbed fi -$prefix surf -e "$xid" "$uri" >/dev/null 2>&1 & +opensurf