diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-20 12:04:39 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-20 12:04:39 +0200 |
commit | e5eb7f627f4632dab17e0cc0f727cb9b1f70d8a1 (patch) | |
tree | 75c7f8560539303e4a5c1f93241a1e8912bad4cc /bin/guiscripts/osurftxt | |
parent | 05e1216b45340702f82a4946002015a05cebe9b1 (diff) | |
parent | 947f7df73f16981f170265a64a964142fc617023 (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/guiscripts/osurftxt')
-rwxr-xr-x | bin/guiscripts/osurftxt | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/bin/guiscripts/osurftxt b/bin/guiscripts/osurftxt index ef60166..9a1d4f4 100755 --- a/bin/guiscripts/osurftxt +++ b/bin/guiscripts/osurftxt @@ -1,22 +1,18 @@ #!/bin/sh -# open all links in txt file into one tabbed surf +# open a link from a txt file in surf # dependencies: surf, osurf, dmenu -# $1: file path for non interactive use -if [ -z "$1" ] -then - d="$HOME/dl/txtabs" - f="$(find "$d" -type f -printf '%f\n' | dmenu)" - [ "$f" ] || exit 1 - f="$d"/"$f" -else - [ -f "$1" ] || exit 1 - f="$1" -fi +winid="$1" +>&2 printf 'winid: %s\n' "$winid" +tabs="$HOME/dl/txtabs" -winid="$(osurf "$(head -n 1 "$f")")" -tail -n +2 "$f" | while read -r url; - do surf -e "$winid" "$url" & - done +f="$(find "$tabs" -type f -printf '%f\n' | dmenu -c)" +[ "$f" ] || exit 1 +f="$tabs"/"$f" +>&2 printf 'f: %s\n' "$f" + +url="$(dmenu -c < "$f")" + +printf 'loaduri %s' "$url" > $HOME/.config/surf/fifo/$winid |