summaryrefslogtreecommitdiff
path: root/.w3m/cgi-bin/fn_restore_tab.cgi
diff options
context:
space:
mode:
Diffstat (limited to '.w3m/cgi-bin/fn_restore_tab.cgi')
-rwxr-xr-x.w3m/cgi-bin/fn_restore_tab.cgi10
1 files changed, 10 insertions, 0 deletions
diff --git a/.w3m/cgi-bin/fn_restore_tab.cgi b/.w3m/cgi-bin/fn_restore_tab.cgi
new file mode 100755
index 0000000..234adef
--- /dev/null
+++ b/.w3m/cgi-bin/fn_restore_tab.cgi
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+# demo: https://www.youtube.com/watch?v=e5_q3-r6PAU
+echo "W3m-control: BACK"
+FILE="$HOME/.w3m/RestoreTab.txt"
+LAST_TAB=$(tail -n 1 "$FILE") # Open the last closed tab
+LIMIT=$(tail -n 20 "$FILE") # Limit of tabs stored
+OTHER_TABS=$(printf "%s" "$LIMIT" | head -n -1)
+echo "$OTHER_TABS" > "$FILE"
+echo "W3m-control: TAB_GOTO $LAST_TAB"
+echo "W3m-control: DELETE_PREVBUF"