===== Session Uzbl =====
===== Description ======
This script will let you save all uzbl windows that are open ( the url's) and restore them, this would be usefull if you are using a tabbed layout from you own Window Manager. Because uzbl_tabbed.py already has a session restoring function.
===== Requirements =====
* Bash
===== Installation =====
Copy the script to your scripts folder. And bind it:
bind = sh '/path/to/script/sessionuzbl -s'
Now you can save your sessions with the custom . For restoring i use my own window manager keybindings. Just take a look at
./sessionuzbl -h
For more info. If you want to change the location where the urls get saved , modify $url_file = /path/to/session .
===== Script =====
#!/bin/bash
# Save your opened uzbl windows, with a simple bash script and write it to an text file
# you can add this too your uzbl config for example
# bind xall = sh '/path/to/script/sessionuzbl -s'
# Socket dir and save location
socket_dir="/tmp"
url_file="$HOME/.uzbl_uris"
badarg () {
echo "sessionuzbl: Try \`sessionuzbl -h' for more information." >&2
}
usage () {
echo "sessionuzbl: save or restore your last session of uzbl"
echo "usage: sessionuzbl [OPTIONS]"
echo
echo "OPTIONS"
echo " -s: save the open uzbl windows"
echo " -r: restore the uzbl windows"
echo " -v: show the version"
echo " -h: show help"
echo
}
# save the open urls
save() {
# remove the old urls
rm $url_file
# save the open uzbl sessions in an text file
for socket in $socket_dir/uzbl_socket_*; do
uzblctrl -s $socket -c 'print @uri' >> $url_file
uzblctrl -s $socket -c 'exit'
done
}
# restore the old sessions from the txt file
restore() {
exec < $url_file
while read line
do
uzbl -u $line &
done
}
# opt parsing
while getopts ":srhv" opt; do
case "$opt" in
"s")
save
;;
"r")
restore
;;
"v")
echo "sessionuzbl: version 0.1 (GPL) "
;;
"h")
usage
;;
"?")
echo "sessionuzbl: invalid option: -$OPTARG" >&2
badarg
exit 1
;;
*)
echo "sessionuzbl: unknown error while processing options." >&2
badarg
exit 1
;;
esac
done