diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-17 06:10:02 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-17 06:10:02 +0300 |
commit | 484181c25cba61469254e24bff578cff5189c8a7 (patch) | |
tree | 6bb3b33b3c710467a6f0463912b929f2e039cd90 /dotfiles/.local/bin/rofiwebsurf | |
parent | 0b065dc2c0cae46c4f6151483249a682db122eb6 (diff) | |
download | swayrice-484181c25cba61469254e24bff578cff5189c8a7.tar.gz swayrice-484181c25cba61469254e24bff578cff5189c8a7.zip |
WIP: move to rofi
Diffstat (limited to 'dotfiles/.local/bin/rofiwebsurf')
-rwxr-xr-x | dotfiles/.local/bin/rofiwebsurf | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/rofiwebsurf b/dotfiles/.local/bin/rofiwebsurf new file mode 100755 index 0000000..b6f6e87 --- /dev/null +++ b/dotfiles/.local/bin/rofiwebsurf @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ "$ROFI_RETV" != 0 ]; then + choice="$1" + if echo "$choice" | egrep ".*://.*" >/dev/null 2>&1; then + choice="$(echo "$choice" | sed -E 's/(.*:\/\/([^[:space:]])*).*/\1/g' | + grep -E "https?:" || echo "$choice")" + mimeo "$choice" > /dev/null + else + setsid $BROWSER "$choice" > /dev/null & + fi + exit 0 +fi + +qmarks="$HOME/.config/qutebrowser/quickmarks" +bmarks="$HOME/.config/qutebrowser/bookmarks/urls" +hist="$HOME/.local/share/qutebrowser/history.sqlite" +prompt="$(sqlite3 -separator ' ' "$hist" \ + 'select title, url from CompletionHistory' | + cat "$qmarks" - | cat "$bmarks" -)" + +echo -ne "\0prompt\x1fEnter query or link\n" +printf "%s" "$prompt" |