commit 9e537687bcc886a81abd68cd167cbb1d96b0dcc3 parent 63422474cf6e0f1e64b48e9191194079017ed40a Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 27 Jan 2021 10:49:18 +0100 urlgrab: auto-click for xprop(1) and reverse url order Diffstat:
M | .local/bin/urlgrab | | | 11 | ++++++----- |
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/.local/bin/urlgrab b/.local/bin/urlgrab @@ -1,14 +1,15 @@ #!/bin/sh set -e -pid=$(xprop | awk '/_NET_WM_PID/ { print $3 }') -f="${HOME}/.cache/st/$(date +%Y-%m-%d)/"*".$pid" -urls="$(cat $f | extract_urls)" if [ -z "$TERM" -o "$TERM" = linux -o "$TERM" = dumb ]; then menu="dmenu -i" else menu="fzy" fi -c="$(printf '%s\n' "$urls" | $menu)" -if [ "$c" ]; then +(sleep 1; xdotool click 1) & +pid="$(xprop | awk '/_NET_WM_PID/ { print $3 }')" +f="${HOME}/.cache/st/$(date +%Y-%m-%d)/"*".$pid" +urls="$(cat $f | extract_urls)" +c="$(printf '%s\n' "$urls" | reverse | $menu)" +if test "$c"; then plumb "$c" fi