Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active August 7, 2026 07:24
Show Gist options
  • Select an option

  • Save tyjak/97a58a00c5329e60f884be59595dd69f to your computer and use it in GitHub Desktop.

Select an option

Save tyjak/97a58a00c5329e60f884be59595dd69f to your computer and use it in GitHub Desktop.
#!/bin/sh
# dmenu scripts to search in firefox bookmark and paste it in the clipboard
# GistID: 97a58a00c5329e60f884be59595dd69f
# The bookmark folder to list
bookmark_folder=share
firefox_profile=~/.mozilla/firefox/$(sed '2!d;s/Default=//' ~/.mozilla/firefox/profiles.ini)
database=file:${firefox_profile}/places.sqlite?immutable=1
url=$(sqlite3 -line $database <<EOF | sed 's/^title: //;s/\s\+url: /[/' - | paste -d ' ' - - - | sed 's/\s\+$/]/' | dmenu -l 20 -b -i -nb '#002b36' -nf '#839496' -sb '#859900' -fn 'MesloLGSDZ Nerd Font-10' -h ${DMENUHEIGHT:-36}
SELECT b.title, p.url FROM moz_bookmarks b JOIN moz_places p ON b.fk = p.id JOIN moz_bookmarks t ON t.id = b.parent WHERE t.title='$bookmark_folder'
EOF
)
if [ "${url#*\[http}" != "$url" ]; then
echo -n "$url" | sed 's/^.*\[http//;s/^/http/;s/\]$//' | xsel -i
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment