User Tools

Site Tools


undo

Description:

This script allows you to open closed window.

Undo script

#!/bin/bash
UNDO="$XDG_DATA_HOME/uzbl/undolist"
UZBL=uzbl-browser
if [ -e $UNDO ]; then
    URL=`tail -n 1 $UNDO`
    LINECOUNT=`cat $UNDO | wc -l`
    if [[ $LINECOUNT == 1 ]]; then
        $UZBL -u "$URL" &
        rm $UNDO
    else
        $UZBL -u "$URL" &
        sed -i '$d' $UNDO
    fi
fi

Exit script

#!/bin/sh
UNDO="$XDG_DATA_HOME/uzbl/undolist"
if [ -e $UNDO ]; then
    LINECOUNT=`cat $UNDO | wc -l`
    if [ $LINECOUNT -ge 100 ]; then
        sed -i "1d" $UNDO
    fi
fi
echo "$6" >> $UNDO

Usage:

Save the above scripts and add binding to them, for example:

bind d  = chain 'spawn $XDG_CONFIG_HOME/uzbl/scripts/exit.sh' 'exit'
undo.txt · Last modified: 2016/08/31 14:10 (external edit)