1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-03-19 18:17:45 +01:00
dotfiles/.local/bin/tools/dwm/startpagesearch

23 lines
623 B
Plaintext
Raw Normal View History

2020-03-31 20:32:16 +02:00
#!/bin/sh
2020-04-02 00:06:34 +02:00
2020-03-31 20:32:16 +02:00
# Gives a dmenu prompt to search Startpage.
# Without input, will open Startpage.com.
# URLs will be directly handed to the browser.
# Anything else, it search it.
2020-04-02 00:06:34 +02:00
# original by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
2020-03-31 20:32:16 +02:00
pgrep -x dmenu && exit
choice=$(echo "Startpage" | dmenu -i -p "Search Startpage:") || exit 1
if [ "$choice" = "Startpage" ]; then
$BROWSER "https://startpage.com"
2020-03-31 20:32:16 +02:00
else
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
$BROWSER "$choice"
2020-03-31 20:32:16 +02:00
else
$BROWSER "https://startpage.com/do/search/?q=$choice"
2020-03-31 20:32:16 +02:00
fi
fi