You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# AUTHOR: Junegunn Choi (https://github.com/junegunn)
# DESC: open chromium web history
# DEPEND: fzf chromium
# REFF: https://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/
# https://github.com/junegunn/fzf/wiki/examples#browsing-history
local cols sep
cols=$(( COLUMNS / 3 ))
sep='{::}'
# MacOS
# \cp -f ~/Library/Application\ Support/Google/Chrome/Default/History /tmp/h
# Linux
\cp -f ~/.config/chromium/Default/History /tmp/h
sqlite3 -separator $sep /tmp/h \
"select substr(title, 1, $cols), url
from urls order by last_visit_time desc" |
awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' |
fzf --ansi --multi --reverse | sed 's#.*\(https*://\)#\1#' | xargs setsid xdg-open
# MacOS
# fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
# selected="$(grep -E '^([[:alnum:]])' ~/.config/surfraw/bookmarks | sort -n | fzf -e -i -m | awk '{print $1}')"
# [ -z "$selected" ] && exit
# echo "$selected" | tr ' ' '\n' | while read -r line ; do surfraw -browser="$BROWSER" "$line" ; done