Big cleanup for a big commit.
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# rofi-bookmarks: pick a Chromium bookmark and open it (new tab or new window)
|
||||
|
||||
set -euo pipefail
|
||||
awesome-client 'show_dim()' >/dev/null 2>&1
|
||||
|
||||
BOOKMARKS_FILE="$HOME/.config/chromium/Default/Bookmarks"
|
||||
|
||||
if [ ! -f "$BOOKMARKS_FILE" ]; then
|
||||
notify-send "Bookmarks" "Chromium bookmarks file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Recursively walk the bookmark tree (roots -> bookmark_bar / other / synced)
|
||||
# and emit "title\turl" for every leaf ("type": "url"), skipping folders.
|
||||
list=$(jq -r '
|
||||
def walk_nodes:
|
||||
if .type == "url" then
|
||||
"\(.name)\t\(.url)"
|
||||
elif .children then
|
||||
.children[] | walk_nodes
|
||||
else
|
||||
empty
|
||||
end;
|
||||
.roots | to_entries[] | .value | walk_nodes
|
||||
' "$BOOKMARKS_FILE")
|
||||
|
||||
if [ -z "$list" ]; then
|
||||
notify-send "Bookmarks" "No bookmarks found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
chosen=$(echo "$list" | awk -F'\t' '{print $1}' | rofi -dmenu -i -p "Bookmarks" \
|
||||
-theme-str 'listview { lines: 5; }' \
|
||||
-theme-str 'window { width: 21%; }' \
|
||||
-theme-str 'window { height: 400px; }')
|
||||
|
||||
[ -z "$chosen" ] && exit 0
|
||||
|
||||
url=$(echo "$list" | awk -F'\t' -v title="$chosen" '$1 == title { print $2; exit }')
|
||||
|
||||
[ -z "$url" ] && exit 0
|
||||
|
||||
# Open in a new tab of the existing Chromium window if one's running,
|
||||
# otherwise this also launches Chromium fresh with that tab.
|
||||
librewolf --new-tab "$url"
|
||||
trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Nothing to clean for the previewer above, but lf requires this script.
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for file in "$@"; do
|
||||
case "$file" in
|
||||
*.tar) tar xvf "$file" ;;
|
||||
*.tar.gz|*.tgz) tar xzvf "$file" ;;
|
||||
*.tar.bz2|*.tbz2) tar xjvf "$file" ;;
|
||||
*.tar.xz|*.txz) tar xJvf "$file" ;;
|
||||
*.zip) unzip "$file" ;;
|
||||
*.rar) unrar x "$file" ;;
|
||||
*.7z) 7z x "$file" ;;
|
||||
*.gz) gunzip "$file" ;;
|
||||
*.bz2) bunzip2 "$file" ;;
|
||||
*.xz) unxz "$file" ;;
|
||||
*) echo "Unknown archive type: $file" ;;
|
||||
esac
|
||||
done
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
file="$1"
|
||||
w="$2"
|
||||
h="$3"
|
||||
|
||||
case "$(file -Lb --mime-type "$file")" in
|
||||
text/*|application/json|application/x-empty|inode/x-empty)
|
||||
bat --theme="ansi" --color=always --style=numbers --line-range=:500 --terminal-width="$w" "$file"
|
||||
;;
|
||||
image/*)
|
||||
echo "Image: $file"
|
||||
;;
|
||||
application/pdf)
|
||||
pdftotext -l 10 -nopgbrk -q "$file" - | fold -s -w "$w"
|
||||
;;
|
||||
application/zip|application/x-tar|application/x-rar|application/x-7z-compressed|application/gzip|application/x-bzip2|application/x-xz)
|
||||
echo "Archive: $file"
|
||||
echo
|
||||
case "$file" in
|
||||
*.zip) unzip -l "$file" ;;
|
||||
*.tar|*.tar.*|*.tgz) tar tf "$file" ;;
|
||||
*.rar) unrar l "$file" ;;
|
||||
*.7z) 7z l "$file" ;;
|
||||
*) echo "Archive listing not supported" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
file -Lb "$file"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user