deanishe / deanishe/alfred-firefox

add bookmark search by tag

Open
#15 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
361
Forks
19
PR merge metrics
No merged PRs in 30d

Description

I'm a heavy user of [firefox bm tags](https://support.mozilla.org/en-US/kb/categorizing-bookmarks-make-them-easy-to-find)

It's an awesome feature that helps group bookmarks.
Currently, firefox allows searching for a bm by tag in its search bar by starting the query with an asterisk
\* banana
will search for all bookmarks tagged with a `banana` tag.

---
I'll be more than happy to help to add this functionality to your awesome workflow.
Given some instructions. I've tried to figure it for myself but it seems there are many things going on in there
a client that communicates with a local service over gRPC which communicates with a firefox extension process via STDIN/STOUT.
lots of fun :)

gr8 work.

cheers.

p.s
adding favicons of bookmarks to the alfred output will be awesome.

in addition.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Work_with_the_Bookmarks_API
I can't find anything related to bookmarks in the mozila extensions API docs....

The only thing ive managed to do in order to find bookmarks by tag is this ugly bash script
```bash
BOOKMARKS="/Users/domrevigor/Library/Application Support/Firefox/Profiles/current.profile/bookmarks.html"

lines=($(egrep -no 'TAGS="[^"]+' "${BOOKMARKS}" | grep $1 | cut -d ":" -f1))

links=($(for i in ${lines[@]}; do sed -n ${i}p "${BOOKMARKS}" ;done | egrep -o 'HREF="[^"]*' | cut -d '"' -f2))

tags=($(for i in ${lines[@]}; do sed -n ${i}p "${BOOKMARKS}" ;done | egrep -o 'TAGS="[^"]*' | cut -d '"' -f2))

IFS=$(echo -en "\n\b")
titles=($(for i in ${lines[@]}; do sed -n ${i}p "${BOOKMARKS}" ;done | egrep -o '.*' | egrep -o ">[^<]+" | cut -d '>' -f2))

for i in `seq ${#lines}`;do /usr/local/bin/jq -n "{\"title\":\"${titles[$i]}\","arg":\"${links[$i]}\",\"subtitle\":\"${tags[$i]}\",\"id\":\"${titles[$i]}\"}"; done | /usr/local/bin/jq -s '{"items":map(.)}'
```
which just greps over bookmarks.html file.
however, this file is updated only after browser restart, which sucks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.