Skip to content

Instantly share code, notes, and snippets.

@mekb-turtle
Last active February 10, 2023 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mekb-turtle/3f91296167b099c01b10000d31d9176d to your computer and use it in GitHub Desktop.
Save mekb-turtle/3f91296167b099c01b10000d31d9176d to your computer and use it in GitHub Desktop.
script to search locally downloaded ArchWiki pages using dmenu
#!/usr/bin/bash
HTML_CLIENT="librewolf"
AW="/usr/share/doc/arch-wiki/html/$(locale|grep "^LANG="|sed "s|^LANG=||;s|[_. :].*||")"
while true; do
if [[ -d "$AW" ]]; then
cd -- "$AW"
RES="$(printf "%s\n" Cancel * | dmenu -i)"
if [[ "$RES" == "Cancel" ]]; then exit; fi
AW="$AW/$RES"
else if [[ -f "$AW" ]]; then
"$HTML_CLIENT" "$AW"
exit
else
exit
fi; fi
done
dmenu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment