commit 2433f6a

hovercats  ·  2022-01-26 12:57:21 +0000 UTC
parent 106e9d5
dsearch: add
1 files changed,  +26, -0
+26, -0
 1@@ -0,0 +1,26 @@
 2+#!/bin/sh -e
 3+
 4+# A really simple script to search the web, from dmenu with your browser and
 5+# search engine of choice.
 6+# It will only handle search strings, which means if you type an actual URL,
 7+# $BROWSER will then search for that string on $ENGINE.
 8+
 9+# Change this to w/e floats your boat.
10+BROWSER="surf -d"
11+
12+# You can change this to w/e searchengine you like, aslong as its similarly
13+# formatted as below.
14+# Check your searchengine to be sure.
15+ENGINE='https://duckduckgo.com/?q='
16+
17+# Set search string as a variable, and remove spaces, as we cant have any spaces
18+# in our URL. Also make sure the substitution is correct if you change to a
19+# different search engine as they might not be the same.
20+STRING=$(printf '' | dmenu -p 'Search' | sed 's/ /%20l/g')
21+
22+# exit if $STRING is empty.
23+if [ "$STRING" = '' ]; then
24+    exit 0
25+else
26+    $BROWSER "$ENGINE$STRING"
27+fi