feat: bookmarks
This commit is contained in:
parent
ddd00d7844
commit
98ec0130fd
19 changed files with 223 additions and 90 deletions
27
.local/bin/bookmarks
Executable file
27
.local/bin/bookmarks
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
if [ "$1" = -p ]; then
|
||||
BROWSER="$BROWSER --private-window"
|
||||
elif [[ "$(xdotool getwindowfocus getwindowname)" != *'Mozilla Firefox' ]]; then
|
||||
BROWSER="$BROWSER --new-window"
|
||||
fi
|
||||
|
||||
mapfile -t list < <(grep -Pv '^(#|$)' "$XDG_CONFIG_HOME/bookmarks")
|
||||
q="$(printf '%s\n' '' "${list[@]}" | dmenu -l 16)"
|
||||
|
||||
if [ -z "$q" ]; then
|
||||
exec $BROWSER
|
||||
elif [[ "$q" == *://* ]]; then
|
||||
url="${q/*+( )/}"
|
||||
|
||||
if [ "$1" = -p ] || [[ "$url" == http?(s)://* ]]; then
|
||||
exec $BROWSER "$url"
|
||||
fi
|
||||
exec xdg-open "$url"
|
||||
fi
|
||||
if [[ "$q" == *.* ]] && [[ "$q" != *' '* ]]; then
|
||||
exec $BROWSER "$q"
|
||||
fi
|
||||
exec $BROWSER "https://searx.gmoker.com/search?q=$(jq -Rr '@uri' <<< "$q")"
|
Loading…
Add table
Add a link
Reference in a new issue