3 # Very simple session manager for uzbl. When called with "endsession" as the
4 # argument, it'll backup $sessionfile, look for fifos in $fifodir and
5 # instruct each of them to store their current url in $sessionfile and
6 # terminate themselves. Run with "launch" as the argument and an instance of
7 # uzbl will be launched for each stored url. "endinstance" is used internally
8 # and doesn't need to be called manually at any point.
9 # Add a line like 'bind quit = /path/to/session.sh endsession' to your config
11 [ -d ${XDG_DATA_HOME:-$HOME/.local/share}/uzbl ] || exit 1
12 scriptfile=$0 # this script
13 sessionfile=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/session # the file in which the "session" (i.e. urls) are stored
14 configfile=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/config # uzbl configuration file
15 UZBL="uzbl -c $configfile" # add custom flags and whatever here.
17 fifodir=/tmp # remember to change this if you instructed uzbl to put its fifos elsewhere
22 if [ "$act." = "." ]; then
29 urls=`cat $sessionfile`
30 if [ "$urls." = "." ]; then
41 if [ "$url" != "(null)" ]; then
42 echo "$url" >> $sessionfile;
44 echo "exit" > "$thisfifo"
48 mv "$sessionfile" "$sessionfile~"
49 for fifo in $fifodir/uzbl_fifo_*; do
50 if [ "$fifo" != "$thisfifo" ]; then
51 echo "spawn $scriptfile endinstance" > "$fifo"
54 echo "spawn $scriptfile endinstance" > "$thisfifo"
57 * ) echo "session manager: bad action"
58 echo "Usage: $scriptfile [COMMAND] where commands are:"
59 echo " launch - Restore a saved session or start a new one"
60 echo " endsession - Quit the running session. Must be called from uzbl"