mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2024-11-29 18:13:09 +01:00
44 lines
993 B
Nix
44 lines
993 B
Nix
{ pkgs }:
|
||
|
||
pkgs.writeShellScriptBin "web-search" ''
|
||
declare -A URLS
|
||
|
||
URLS=(
|
||
["🌎 Search"]="https://search.brave.com/search?q="
|
||
["❄️ Unstable Packages"]="https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query="
|
||
["🎞️ YouTube"]="https://www.youtube.com/results?search_query="
|
||
["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/"
|
||
["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title="
|
||
)
|
||
|
||
# List for rofi
|
||
gen_list() {
|
||
for i in "''${!URLS[@]}"
|
||
do
|
||
echo "$i"
|
||
done
|
||
}
|
||
|
||
main() {
|
||
# Pass the list to rofi
|
||
platform=$( (gen_list) | ${pkgs.wofi}/bin/wofi -dmenu )
|
||
|
||
if [[ -n "$platform" ]]; then
|
||
query=$( (echo ) | ${pkgs.wofi}/bin/wofi -dmenu )
|
||
|
||
if [[ -n "$query" ]]; then
|
||
url=''${URLS[$platform]}$query
|
||
xdg-open "$url"
|
||
else
|
||
exit
|
||
fi
|
||
else
|
||
exit
|
||
fi
|
||
}
|
||
|
||
main
|
||
|
||
exit 0
|
||
''
|