diff --git a/bin/rofi/bookmarks b/bin/rofi/bookmarks deleted file mode 100755 index 0ba942ce..00000000 --- a/bin/rofi/bookmarks +++ /dev/null @@ -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 diff --git a/bin/rofi/calc b/bin/rofi/calc deleted file mode 100755 index 04c80a47..00000000 --- a/bin/rofi/calc +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -rofi -show calc -modi "calc:qalc +u8" diff --git a/bin/rofi/file b/bin/rofi/file deleted file mode 100755 index cf8b7e52..00000000 --- a/bin/rofi/file +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -DIR="$(fd -L --type d . $HOME | rofi -dmenu)" -if [ -d "$DIR" ]; then - cd "$DIR" - xst -fi diff --git a/bin/rofi/history b/bin/rofi/history deleted file mode 100755 index c27dcae6..00000000 --- a/bin/rofi/history +++ /dev/null @@ -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 diff --git a/bin/rofi/ssh b/bin/rofi/ssh deleted file mode 100755 index 57efae00..00000000 --- a/bin/rofi/ssh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -rofi -show ssh -multi-select