Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active December 12, 2025 15:50
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/^\s\+url = //;s/^title = //' - | paste -d ' ' - - - | dmenu -l 20 -b -i -nb '#002b36' -nf '#839496' -sb '#859900' -fn 'MesloLGSDZ Nerd Font-10' -h ${DMENUHEIGHT:-36}
SELECT p.url, b.title 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" != "" ];then
# retrive url only
if [ "${url:0:4}" = "http" ];then
url=${url%% *}
fi
echo -n "$url" | xsel -i
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment