summaryrefslogtreecommitdiffstats
path: root/local/bin/dmenu-webshortcuts.sh
diff options
context:
space:
mode:
Diffstat (limited to 'local/bin/dmenu-webshortcuts.sh')
-rwxr-xr-xlocal/bin/dmenu-webshortcuts.sh93
1 files changed, 0 insertions, 93 deletions
diff --git a/local/bin/dmenu-webshortcuts.sh b/local/bin/dmenu-webshortcuts.sh
deleted file mode 100755
index e1d233c..0000000
--- a/local/bin/dmenu-webshortcuts.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/bash
-
-# Use dmenu and user-defined web shorcuts to query websites faster.
-#
-# This script tries to mimic Krunner Web Search Keywords functionality.
-# See: https://userbase.kde.org/Plasma/Krunner#Browse_websites
-#
-# TODO: Integrate it to dmenu_run (so that this script doens't require a
-# dedicated keybinding)
-#
-# Mitsuo
-# 2023-11-23
-
-input=$(echo "" | dmenu -p 'wp:Hello World')
-## Set Internal Field Separator, save separated fields as an array in $CMD (-a),
-## don't allow backslashes to escape any characters (-r). Feed $input as stdin.
-#IFS=':' read -ra CMD <<< "$input"
-#keyword=${CMD[0]}
-#search_term=${CMD[1]}
-keyword="${input%%:*}"
-search_term="${input#*:}"
-
-# Define web shortcuts here
-case "$keyword" in
- # Search
- "dd") xdg-open "https://duckduckgo.com/?t=h_&q=${search_term// /+}" ;;
- "gg") xdg-open "https://www.google.com/search?q=$search_term" ;;
- "bing") xdg-open "https://www.bing.com/search?q=${search_term// /+}" ;;
- "metac") xdg-open "https://www.metacrawler.com/serp?q=${search_term// /+}" ;;
-
- # Finance
- "ggf") xdg-open "https://www.google.com/finance/quote/$search_term?window=1Y" ;;
- "yf") xdg-open "https://finance.yahoo.com/quote/$search_term" ;;
- "bb") xdg-open "https://www.bloomberg.com/quote/$search_term" ;;
-
- # Maps
- "ggm") xdg-open "https://www.google.com/maps/search/${search_term// /+}" ;;
- "osm") xdg-open "https://www.openstreetmap.org/search?query=$search_term" ;;
-
- # Reference
- "wp") xdg-open "https://en.wikipedia.org/wiki/${search_term// /_}" ;;
- "wt") xdg-open "https://en.wiktionary.org/wiki/${search_term// /_}" ;;
- "wv") xdg-open "https://en.wikivoyage.org/wiki/${search_term// /_}" ;;
- "scholar") xdg-open "https://scholar.google.com/scholar?hl=en&q=${search_query// /+}" ;;
- "arxiv") xdg-open "https://arxiv.org/search/?query=${search_query// /+}" ;;
-
- # Computer
- "arch") xdg-open "https://wiki.archlinux.org/index.php?search=${search_term// /+}" ;;
- "aur") xdg-open "https://aur.archlinux.org/packages?O=0&K=${search_term// /+}" ;;
- "so") xdg-open "https://stackoverflow.com/search?q=${search_term// /+}" ;;
- "gh") xdg-open "https://github.com/search?q=${search_term// /+}&type=repositories" ;;
- "gl") xdg-open "https://about.gitlab.com/search?searchText=$search_term" ;;
- "pypi") xdg-open "https://pypi.org/search/?q=${search_term// /+}&o=" ;;
- "npm") xdg-open "https://www.npmjs.com/search?q=${search_term// /+}" ;;
-
- # Media
- "yt") xdg-open "https://www.youtube.com/results?search_query=$search_term" ;;
- "vm") xdg-open "https://vimeo.com/search?q=$search_term" ;;
- "sp") xdg-open "https://open.spotify.com/search/$search_term" ;;
- "sc") xdg-open "https://soundcloud.com/search?q=$search_term" ;;
- "dz") xdg-open "https://www.deezer.com/search/$search_term" ;;
- "imdb") xdg-open "https://www.imdb.com/find/?q=$search_term" ;;
-
- # Social Media
- "x") xdg-open "https://x.com/search?q=$search_term&src=typed_query" ;;
- "rd") xdg-open "https://duckduckgo.com/?t=h_&q=site%3Areddit.com+${search_term// /+}&ia=web" ;;
- "ig") xdg-open "https://duckduckgo.com/?q=site%3Ainstagram.com+${search_term// /+}&ia=web" ;;
- "fb") xdg-open "https://duckduckgo.com/?q=site%3Afacebook.com+${search_term// /+}&ia=web" ;;
-
- # Shopping
- "amzn") xdg-open "https://www.amazon.com/s?k=${search_term// /+}" ;;
- "amznjp") xdg-open "https://www.amazon.co.jp/s?k=${search_term// /+}" ;;
- "ebay") xdg-open "https://www.ebay.com/sch/i.html?_nkw=${search_term// /+}" ;;
-
- # Utilities
- "ggt") xdg-open "https://translate.google.com/?sl=auto&tl=en&text=$search_term&op=translate" ;;
- "en2es") xdg-open "https://www.wordreference.com/es/translation.asp?tranword=$search_term" ;;
- "es2en") xdg-open "https://www.wordreference.com/es/en/translation.asp?spen=$search_term" ;;
- "en2de") xdg-open "https://www.wordreference.com/es/en/translation.asp?spen=$search_term" ;;
- "de2en") xdg-open "https://www.wordreference.com/deen/$search_term" ;;
- "jisho") xdg-open "https://jisho.org/search/$search_term" ;;
- "rae") xdg-open "https://dle.rae.es/?w=$search_term" ;;
-
- # Mitsuo
- "pw") xdg-open "http://wiki.pulse15/index.php?search=${search_term// /+}" ;;
- "factorio") xdg-open "https://wiki.factorio.com/${search_term// /_}" ;;
- "dst") xdg-open "https://dontstarve.wiki.gg/wiki/${search_term// /_}" ;;
- "mc") xdg-open "https://minecraft.wiki/w/${search_term// /_}" ;;
- "terraria") xdg-open "https://terraria.wiki.gg/wiki/${search_term// /_}" ;;
-
- *) exit 1 ;;
-esac
-