Snippets

Samuel Laurén Firefox history with fzf

Created by Samuel Laurén last modified
declare -r FIREFOX_PROFILE='DEFAULT PROFILE NAME HERE'

function ff-history {
    local c="$(( COLUMNS / 3 ))"
    local sep=$'\37'
    local selection="$(sqlite3 -separator $sep \
          ~/.mozilla/firefox/${1:-${FIREFOX_PROFILE}}/places.sqlite \
          "SELECT title, url FROM moz_places ORDER BY last_visit_date DESC;" \
          | awk -F $sep '{printf "\033[1;34m%-'$c's\033[0m %s\n", substr($1, 0, '$c'), $2}' \
          | fzf --ansi)"
    if [[ ! -z "$selection" ]]; then
        echo "$selection" \
            | sed 's#.*\(https*://\)#\1#' \
            | xargs xdg-open
    fi
}

alias ffgrep="ff-history"

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.