diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-09 18:21:35 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-09 18:21:35 +0200 |
commit | 02da333eb51cc5f7cfc28e194681db0e5f59d485 (patch) | |
tree | 8a6c6a629acceb22eb481ea97341c9f2a0f6cd9c /bin | |
parent | 1db03774f313f1d740cda3f7e4dbc05a50c75d15 (diff) |
checkpoint
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common/ytlink | 20 | ||||
-rwxr-xr-x | bin/extra/qrclip | 12 | ||||
-rwxr-xr-x | bin/guiscripts/clipo | 4 | ||||
-rwxr-xr-x | bin/guiscripts/clipp | 6 |
4 files changed, 30 insertions, 12 deletions
diff --git a/bin/common/ytlink b/bin/common/ytlink index 48be9cf..215c164 100755 --- a/bin/common/ytlink +++ b/bin/common/ytlink @@ -2,15 +2,21 @@ # convert to youtube.com/path url # works for: -# - 'youtu.be/watch?v=xxxxxx' +# - 'youtu.be/xxxxxx' # - 'https://piped.video/watch?v=xxxxx' +# - https://youtube.com/watch?v=xxxx -inp="$1" -[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" +# get from $1 or clipboard if empty +vid="${1:-$(clipo)}" +# The following subsitutions will try to grab the video id # if link is http://127.0.0.1:9010/https://www.youtube.com/watch?v=7KpxsqwNF0o -inp="${inp#*/https://}" +vid="${vid#*/https://}" # remove util scheme -inp="${inp#*//}" -inp="https://youtube.com/${inp#*/}" -printf "%s" "$inp" +vid="${vid#*//}" +# remove domain +vid="${vid#*/}" +# remove query string +vid="${vid#watch?v=}" + +printf "https://youtube.com/watch?v=%s\n" "$vid" diff --git a/bin/extra/qrclip b/bin/extra/qrclip new file mode 100755 index 0000000..f9dc92e --- /dev/null +++ b/bin/extra/qrclip @@ -0,0 +1,12 @@ +#!/bin/sh +case $1 in + '-o') + qrencode -s 16 "$(clipo)" -o - | + imv -w "imv - $(clipo)" - ;; + '-s') + qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | + imv -w "imv - search $(clipo)" - ;; + *) + >&2 printf 'qrclip [-s | -o]\n' + exit 1 +esac diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index 078cc13..ebc9a25 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j="-b" if [ "$WAYLAND_DISPLAY" ] then wl-paste -n "$1" -else xclip -o -selection "${arg:-clipboard}" -r +else xsel -o $j fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index c9e4f51..d545087 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j='-b' if [ "$WAYLAND_DISPLAY" ] -then wl-copy -n $1 -else xclip -selection "${arg:-clipboard}" -r +then wl-copy -n $i +else xsel $j fi |