[hackers] [surf] Adding a surf-open.sh script for easier tabbed(1) integration. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Fri, 16 Nov 2012 16:14:13 +0100 (CET)

changeset: 269:550dadf12096
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Fri Nov 16 16:12:09 2012 +0100
files: README config.def.h surf-open.sh
description:
Adding a surf-open.sh script for easier tabbed(1) integration.


diff -r 4f73a45ac631 -r 550dadf12096 README
--- a/README Fri Nov 16 10:53:30 2012 +0100
+++ b/README Fri Nov 16 16:12:09 2012 +0100
_AT_@ -17,9 +17,22 @@
 
     make clean install
 
-
 Running surf
 ------------
 run
- surf [URL]
+ surf [URI]
 
+See the manpage for further options.
+
+Running surf in tabbed
+----------------------
+For running surf in tabbed[0] there is a script included in the distribution,
+which is run like this:
+
+ surf-open.sh [URI]
+
+Further invocations of the script will run surf with the specified URI in this
+instance of tabbed.
+
+[0] http://tools.suckless.org/tabbed
+
diff -r 4f73a45ac631 -r 550dadf12096 config.def.h
--- a/config.def.h Fri Nov 16 10:53:30 2012 +0100
+++ b/config.def.h Fri Nov 16 16:12:09 2012 +0100
_AT_@ -13,6 +13,8 @@
 static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
 static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
 static int indicator_thickness = 2;
+
+/* Webkit features */
 static Bool spatialbrowsing = TRUE;
 static Bool hidebackground = FALSE;
 
diff -r 4f73a45ac631 -r 550dadf12096 surf-open.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/surf-open.sh Fri Nov 16 16:12:09 2012 +0100
_AT_@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# See the LICENSE file for copyright and license details.
+#
+
+xidfile="$HOME/tmp/tabbed-surf.xid"
+uri=""
+
+if [ "$#" -gt 0 ];
+then
+ uri="$1"
+fi
+
+runtabbed() {
+ tabbed -dn tabbed-surf -r 2 surf -e '' "$uri" >"$xidfile" \
+ 2>/dev/null &
+}
+
+if [ ! -r "$xidfile" ];
+then
+ runtabbed
+else
+ xid=$(cat "$xidfile")
+ xprop -id "$xid" 2>&1 >/dev/null
+ if [ $? -gt 0 ];
+ then
+ runtabbed
+ else
+ surf -e "$xid" "$uri" 2>&1 >/dev/null &
+ fi
+fi
+
Received on Fri Nov 16 2012 - 16:14:13 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 16 2012 - 16:24:07 CET