Remove old bin/rofi scripts

This commit is contained in:
Henrik Lissner 2019-12-09 02:52:08 -05:00
parent d46b38c389
commit 6820a8a51c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 0 additions and 125 deletions

View file

@ -1,56 +0,0 @@
#!/usr/bin/env bash
# Interactively select (in skim) bookmarks to open from Firefox or
# Chrome/Chromium (depends on $BROWSER). Should work on Linux and MacOS.
#
# requires: sqlite3, jq (if you use chrome/chromium)
sep='{{::}}'
_do_rofi() {
for url in $(awk -F "${1:-$sep}" '{printf "%s, %s\n", $1, $2}' | rofi -dmenu -p 'bookmarks > ' -multi-select | sed 's#.*\(https*://\)#\1#'); do
if command -v "$BROWSER" >/dev/null; then
$BROWSER "$url" &
elif command -v open >/dev/null; then
open "$url" &
else
xdg-open "$url" &
fi
done
}
case ${BROWSER:-firefox} in
firefox)
for dir in ~/.mozilla/firefox/*.default \
$XDG_CONFIG_HOME/firefox/.mozilla/firefox/*.default \
$XDG_DATA_HOME/mozilla/firefox/*.default \
~/Library/Application\ Support/Firefox/Profiles/*.default; do
if [[ -d "$dir" ]]; then
# The db can be locked from time to time. This is inefficient, but
# places.sqlite is usually under 30mb so this should be instant, and
# /tmp is cleared at boot so...
cp "$dir/places.sqlite" "/tmp/places.sqlite"
sqlite3 -separator $sep "/tmp/places.sqlite" \
"SELECT DISTINCT mb.title, mp.url FROM moz_bookmarks mb \
INNER JOIN moz_places mp ON mp.id = mb.fk \
WHERE mb.type = 1 AND mb.title IS NOT NULL \
ORDER BY mp.frecency DESC" | _do_rofi
break
fi
done
;;
qutebrowser)
sed -e 's/ /{{::}}/' urls | awk -F'{{::}}' '{printf "%s{{::}}%s\n", $2, $1}' | _do_rofi
;;
*)
for dir in ~/.config/google-chrome/Default ~/.config/chromium/Default ~/Library/Application\ Support/Google/Chrome/Default; do
# requires jq
if [[ -f "$dir/Bookmarks" ]]; then
jq -r '.. | [.name, .url]? | @tsv' "$dir/Bookmarks" | \
sed '/^[ \t]*$/d;/\t$/d;/\tchrome:\/\//d' | \
_do_rofi "\t"
break
fi
done
;;
esac

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
rofi -show calc -modi "calc:qalc +u8"

View file

@ -1,6 +0,0 @@
#!/usr/bin/env sh
DIR="$(fd -L --type d . $HOME | rofi -dmenu)"
if [ -d "$DIR" ]; then
cd "$DIR"
xst
fi

View file

@ -1,59 +0,0 @@
#!/usr/bin/env bash
# Interactively select (in skim) an url from Firefox/Chrome/Chromium history to
# open in your browser (depends on $BROWSER). Should work on Linux and MacOS.
#
# requires: sqlite3
sep='{{::}}'
_do_rofi() {
for url in $(awk -F "${1:-$sep}" '{printf "%s, %s\n", $1, $2}' | rofi -dmenu -p='history > ' -multi-select | sed 's#.*\(https*://\)#\1#'); do
if command -v "$BROWSER" >/dev/null; then
$BROWSER "$url" &
elif command -v open >/dev/null; then
open "$url" &
else
xdg-open "$url" &
fi
done
}
case ${BROWSER:-firefox} in
qutebrowser)
sqlite3 -separator $sep "$XDG_DATA_HOME/qutebrowser/history.sqlite" \
"SELECT title, url FROM History \
WHERE title != '' \
GROUP BY url \
ORDER BY atime DESC" | _do_rofi
;;
firefox)
for dir in ~/.mozilla/firefox/*.default \
$XDG_CONFIG_HOME/firefox/.mozilla/firefox/*.default \
$XDG_DATA_HOME/mozilla/firefox/*.default \
~/Library/Application\ Support/Firefox/Profiles/*.default; do
if [[ -d "$dir" ]]; then
# The db can be locked from time to time. This is inefficient, but
# places.sqlite is usually under 30mb so this should be instant, and
# /tmp is cleared at boot so...
cp "$dir/places.sqlite" "/tmp/places.sqlite"
sqlite3 -separator $sep "/tmp/places.sqlite" \
"SELECT DISTINCT title, url FROM moz_places \
WHERE title IS NOT NULL \
ORDER BY last_visit_date DESC" | _do_rofi
break
fi
done
;;
*)
for dir in ~/.config/google-chrome/Default ~/.config/chromium/Default ~/Library/Application\ Support/Google/Chrome/Default; do
if [[ -f "$dir/History" ]]; then
cp -f "$dir/History" "/tmp/_h"
sqlite3 -separator $sep "/tmp/_h" \
"SELECT substr(title, 1, $((COLUMNS / 3))), url \
FROM urls ORDER BY last_visit_time DESC" | _do_rofi
break
fi
done
;;
esac

View file

@ -1,2 +0,0 @@
#!/usr/bin/env sh
rofi -show ssh -multi-select