diff options
| author | Anders Damsgaard <anders@adamsgaard.dk> | 2018-12-19 10:28:09 +0100 |
|---|---|---|
| committer | Anders Damsgaard <anders@adamsgaard.dk> | 2018-12-19 10:28:09 +0100 |
| commit | ca12ed28a5bfe028463921cb65958a1cf4a66fdb (patch) | |
| tree | 0d714246e7be8868ec7acc9de8ed57f93f36b5a3 /.scripts/i3cmds/ducksearch | |
| parent | 6833d840778897b2304195b13ac75d2a96c08a72 (diff) | |
| download | eibhear-ca12ed28a5bfe028463921cb65958a1cf4a66fdb.tar.gz eibhear-ca12ed28a5bfe028463921cb65958a1cf4a66fdb.tar.zst eibhear-ca12ed28a5bfe028463921cb65958a1cf4a66fdb.zip | |
Revert unneeded changes
Diffstat (limited to '.scripts/i3cmds/ducksearch')
| -rwxr-xr-x | .scripts/i3cmds/ducksearch | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/.scripts/i3cmds/ducksearch b/.scripts/i3cmds/ducksearch index 2f09675..2e14513 100755 --- a/.scripts/i3cmds/ducksearch +++ b/.scripts/i3cmds/ducksearch @@ -1,18 +1,22 @@ #!/bin/sh +# Gives a dmenu prompt to search DuckDuckGo. +# Without input, will open DuckDuckGo.com. +# URLs will be directly handed to the browser. +# Anything else, it search it. browser=${BROWSER:-firefox} pgrep -x dmenu && exit -query=$(echo "duckduckgo.com" | dmenu -i -p "Search DuckDuckGo:") || exit 1 +choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1 -if [ "$query" = "duckduckgo.com" ]; then +if [ "$choice" = "🦆" ]; then $browser "https://duckduckgo.com" else # Detect if url - if [[ "$query" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+.[a-zA-Z]+(/)?.*$ ]]; then - $browser "$query" + if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+.[a-zA-Z]+(/)?.*$ ]]; then + $browser "$choice" else - $browser "https://duckduckgo.com/?q=$query&t=ffab&atb=v1-1" + $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" fi fi |
