From 94924cbb5fdc28ab8c1faa2c346eebbddc966598 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 26 Nov 2010 23:06:32 +0100 Subject: improved session.sh script to work standalone - use readlink to get the absolute path of the script - works standalone as well, just run it and it will either save all running uzbl instances or reopen them - changed backup of sessionfile to launch action, so you can use endinstance from uzbl as well. For example to save a link to read it later --- examples/data/scripts/session.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index 203cd52..a27c577 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -32,9 +32,13 @@ if [ $# -gt 1 ]; then . "$UZBL_UTIL_DIR"/uzbl-args.sh fi -scriptfile=$0 # this script +scriptfile=$(readlink -f $0) # this script act="$1" +if [ -z "$act" ]; then + [ -f "$UZBL_SESSION_FILE" ] && act="launch" || act="endsession" +fi + case $act in "launch" ) urls=$(cat "$UZBL_SESSION_FILE") @@ -45,6 +49,7 @@ case $act in $UZBL --uri "$url" & disown done + mv "$UZBL_SESSION_FILE" "$UZBL_SESSION_FILE~" fi ;; @@ -58,13 +63,12 @@ case $act in ;; "endsession" ) - mv "$UZBL_SESSION_FILE" "$UZBL_SESSION_FILE~" for fifo in "$UZBL_FIFO_DIR"/uzbl_fifo_*; do if [ "$fifo" != "$UZBL_FIFO" ]; then echo "spawn $scriptfile endinstance" > "$fifo" fi done - echo "spawn $scriptfile endinstance" > "$UZBL_FIFO" + [ -z "$UZBL_FIFO" ] || echo "spawn $scriptfile endinstance" > "$UZBL_FIFO" ;; * ) -- cgit v1.2.3