dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone git://edryd.org/dotfiles
Log | Files | Refs

commit 8761b138290e15d3b682a6df3994d5b56d154328
parent 8f4c230972a723987cb1b310647f56c865a7faad
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Fri,  3 Mar 2017 22:22:18 -0800

bin: Add surf_open script

Diffstat:
bin/surf_open | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/bin/surf_open b/bin/surf_open @@ -0,0 +1,26 @@ +#!/bin/sh + +xidfile="$HOME/.surf/tabbed.xid" +uri="" + +if [ "$#" -gt 0 ]; then + uri="$1" +fi + +runtabbed() { + tabbed -cdn tabbed-surf -r 2 surf -e '' "$uri" >"$xidfile" \ + 2>/dev/null & +} + +if [ ! -r "$xidfile" ]; then + runtabbed +else + xid=$(cat "$xidfile") + xprop -id "$xid" >/dev/null 2>&1 + if [ $? -gt 0 ]; then + runtabbed + else + surf -e "$xid" "$uri" >/dev/null 2>&1 & + fi +fi +