Work on bookmark script
This commit is contained in:
parent
ab36c9eb8f
commit
7f0fc4c46d
1 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
BOOKMARKS="$HOME/.surf/bookmarks/"
|
BOOKMARKS="$HOME/.local/share/bookmarks/"
|
||||||
|
|
||||||
|
isxclient=$( readlink /dev/fd/2 | grep -q 'tty' && [[ -n $DISPLAY ]] ; echo $? )
|
||||||
|
if [[ ! -t 2 || $isxclient == "0" ]]; then
|
||||||
|
DMENU="rofi -dmenu"
|
||||||
|
else
|
||||||
|
DMENU="fzf"
|
||||||
|
fi
|
||||||
|
|
||||||
function formatFile(){
|
function formatFile(){
|
||||||
keywords="$(grep -E '^keywords:' "$1" | sed 's/^keywords://')"
|
keywords="$(grep -E '^keywords:' "$1" | sed 's/^keywords://')"
|
||||||
|
@ -10,7 +17,7 @@ export -f formatFile
|
||||||
|
|
||||||
if [ -d "$BOOKMARKS" ]; then
|
if [ -d "$BOOKMARKS" ]; then
|
||||||
cd "$BOOKMARKS"
|
cd "$BOOKMARKS"
|
||||||
selection=$(find . -type f -exec bash -c 'formatFile "{}"' \; | dmenu -l 20 | sed 's/ : .*//')
|
selection=$(fd --type f --exclude README.md --exec bash -c 'formatFile "{}"' ";" . | $DMENU | sed 's/ : .*//')
|
||||||
if [ -f "$selection" ]; then
|
if [ -f "$selection" ]; then
|
||||||
head -n 1 "$selection"
|
head -n 1 "$selection"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue