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 scriptfile=$0 # this script
12 sessionfile=$XDG_DATA_HOME/uzbl/session # the file in which the "session" (i.e. urls) are stored
13 configfile=$XDG_DATA_HOME/uzbl/config # uzbl configuration file
14 UZBL="uzbl -c $configfile" # add custom flags and whatever here.
16 fifodir=/tmp # remember to change this if you instructed uzbl to put its fifos elsewhere
21 if [ "$act." = "." ]; then
28 urls=$(cat $sessionfile)
29 if [ "$urls." = "." ]; then
40 if [ "$url" != "(null)" ]; then
41 echo "$url" >> $sessionfile;
43 echo "exit" > "$thisfifo"
47 mv "$sessionfile" "$sessionfile~"
48 for fifo in $fifodir/uzbl_fifo_*; do
49 if [ "$fifo" != "$thisfifo" ]; then
50 echo "spawn $scriptfile endinstance" > "$fifo"
53 echo "spawn $scriptfile endinstance" > "$thisfifo"
56 * ) echo "session manager: bad action"
57 echo "Usage: $scriptfile [COMMAND] where commands are:"
58 echo " launch - Restore a saved session or start a new one"
59 echo " endsession - Quit the running session. Must be called from uzbl"