summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2022-04-29 21:17:45 -0500
committerstkhan <personal@slickd.xyz>2022-04-29 21:17:45 -0500
commit2274d0839b5bee200a7e7174f1196fcf731ab058 (patch)
treee0407d06d8da404f696e3e85472c7fe2f16cc8e1
parentd4b3ef6f2d1aa93f2e73f371f49efc78d712db45 (diff)
Don't launch browser if no search in browser launch scripts
-rwxr-xr-xdwm-6.3/scripts/dwm-goto10
-rwxr-xr-xdwm-6.3/scripts/dwm-search12
2 files changed, 15 insertions, 7 deletions
diff --git a/dwm-6.3/scripts/dwm-goto b/dwm-6.3/scripts/dwm-goto
index 2033348..c45f9ab 100755
--- a/dwm-6.3/scripts/dwm-goto
+++ b/dwm-6.3/scripts/dwm-goto
@@ -3,6 +3,10 @@
URL=$(cat ~/.config/surf/history.txt | sed 's/^[^ *]* //' | sort -u | dmenu -p "Enter a URL: ")
CMD="firejail --noprofile --hosts-file=~/.config/surf/ads.txt tabbed -dn tabbed-surf -r 2 surf -e '' $URL"
-# saves url to history
-echo $URL >> ~/.config/surf/history.txt
-$CMD
+if [[ -z "$URL" ]]; then
+ exit
+else
+ # saves url to history
+ echo $URL >> ~/.config/surf/history.txt
+ $CMD
+fi
diff --git a/dwm-6.3/scripts/dwm-search b/dwm-6.3/scripts/dwm-search
index 556f215..2ea44c2 100755
--- a/dwm-6.3/scripts/dwm-search
+++ b/dwm-6.3/scripts/dwm-search
@@ -1,10 +1,14 @@
-#!/bin/sh
+#!/bin/bash
QUERY=$(tac ~/.config/surf/search.txt | sort -u | dmenu -p "Search DuckDuckGo: ")
SEARCH=$(echo $QUERY | sed 's/ /+/g')
URL="duckduckgo.com/?q=$SEARCH"
CMD="firejail --noprofile --hosts-file=~/.config/surf/ads.txt tabbed -dn tabbed-surf -r 2 surf -e '' $URL"
-# saves search to history
-echo $QUERY >> ~/.config/surf/search.txt
-$CMD
+if [[ -z "$SEARCH" ]]; then
+ exit
+else
+ # saves search to history
+ echo $QUERY >> ~/.config/surf/search.txt
+ $CMD
+fi