commit aa7b23a362d181b7610d94f707d201e93f4a3dea
parent a605fa3b220d8e964e14a4144b22d382cd53c7f4
Author: Alex Balgavy <alex@balgavy.eu>
Date: Sun, 20 Jun 2021 00:22:57 +0200
w3m: cgi-bin scripts
Diffstat:
4 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/w3m/cgi-bin/get-query.cgi b/w3m/cgi-bin/get-query.cgi
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Ask for a string and save to /tmp/w3m_query
+printf "Query: "
+read -r query
+printf "%s" "$query" > /tmp/w3m_query
diff --git a/w3m/cgi-bin/goto-target-url.cgi b/w3m/cgi-bin/goto-target-url.cgi
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Open contents of /tmp/w3m_target_url
+printf "%s\r\nw3m-control: DELETE_PREVBUF\r\n" "w3m-control: GOTO $(cat /tmp/w3m_target_url)"
diff --git a/w3m/cgi-bin/searx-query.cgi b/w3m/cgi-bin/searx-query.cgi
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Search contents of /tmp/w3m_query with searx
+[ -f /tmp/w3m_query ] || exit
+q="$(cat /tmp/w3m_query)"
+printf "%s\r\nw3m-control: DELETE_PREVBUF\r\n" "w3m-control: GOTO https://search.alex.balgavy.eu/searx/search?q=$q"
diff --git a/w3m/cgi-bin/surfraw.cgi b/w3m/cgi-bin/surfraw.cgi
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Ask for search engine & query, save target URL to /tmp/w3m_target_url
+elvi="$(surfraw -elvi | sed '1,/LOCAL/d' | fzf | cut -f1)"
+[ -z "$elvi" ] && exit
+
+clear
+printf "%s >> Search: " "$elvi"
+read -r query
+surfraw -p "$elvi" "$query" > /tmp/w3m_target_url