From a98ae6bd5a1c7e2d278c5df2b927c0a5427141d0 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 31 Oct 2023 14:31:32 +0100 Subject: turn aliases into scripts This allows for better integration, and makes it possible to call these from other programs, such as window managers, ... --- bin/guiscripts/clipo | 4 ++++ bin/guiscripts/clipp | 4 ++++ 2 files changed, 8 insertions(+) create mode 100755 bin/guiscripts/clipo create mode 100755 bin/guiscripts/clipp (limited to 'bin') diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo new file mode 100755 index 0000000..e3ae714 --- /dev/null +++ b/bin/guiscripts/clipo @@ -0,0 +1,4 @@ +#!/bin/sh +[ "$WAYLAND_DISPLAY" ] && + wl-paste -n || + xclip -o -selection clipboard -r diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp new file mode 100755 index 0000000..538f69b --- /dev/null +++ b/bin/guiscripts/clipp @@ -0,0 +1,4 @@ +#!/bin/sh +[ "$WAYLAND_DISPLAY" ] && + wl-copy -n || + xclip -selection clipboard -r -- cgit v1.2.3 From d99323430cf89e6566899483419f99453140c665 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 31 Oct 2023 14:34:37 +0100 Subject: make help more generic --- bin/extra/supd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index 48638bd..e8eacd4 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -7,7 +7,7 @@ then >&2 cat <<-EOF usage: supd Update dirs in current dir - ls ~/projects | supd Update dirs read from stdin + ... | supd Update dirs read from stdin supd -h Show help EOF exit -- cgit v1.2.3 From af6487bdb195c61574fa353e3bdd5bfe54b2073b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 31 Oct 2023 17:31:52 +0100 Subject: cleanup --- bin/menuscripts/memoji | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'bin') diff --git a/bin/menuscripts/memoji b/bin/menuscripts/memoji index 9c45950..b957981 100755 --- a/bin/menuscripts/memoji +++ b/bin/menuscripts/memoji @@ -5,30 +5,19 @@ # If this file includes emojis below "__DATA__" it is generated. # This file was generated: 2022-04-21 12:38:03+00:00 -if [ "$WAYLAND_DISPLAY" ] -then - alias copycmd="wl-copy" -else - alias copycmd="xclip -sel c" -fi set -e case "$1" in - "list") - data=$(sed '0,/^__DATA__$/d' "$0") - printf "%s" "$data" - ;; + "list") printf "%s" "$(sed '0,/^__DATA__$/d' "$0")" ;; "copy") input=$(tee | cut -f 1 -d ' ') if [ "$input" ] then notify-send "dmemoji" "$input copied!" - printf "%s" "$input" | copycmd + printf "%s" "$input" | clipp fi ;; - "") - sh "$0" list | commander -p "Emoji:" -l -x | sh "$0" copy - ;; + "") sh "$0" list | commander -p "Emoji:" -l -x | sh "$0" copy ;; esac exit -- cgit v1.2.3 From cfb3aed2b81be807d385845cf0807d99dc0d1ac4 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 31 Oct 2023 17:35:38 +0100 Subject: use width and height parameters instead of list --- bin/menuscripts/memoji | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/menuscripts/memoji b/bin/menuscripts/memoji index b957981..45a74f1 100755 --- a/bin/menuscripts/memoji +++ b/bin/menuscripts/memoji @@ -17,7 +17,7 @@ case "$1" in printf "%s" "$input" | clipp fi ;; - "") sh "$0" list | commander -p "Emoji:" -l -x | sh "$0" copy ;; + "") sh "$0" list | commander -p "Emoji:" -x -w 44 -y 10 -c | sh "$0" copy ;; esac exit -- cgit v1.2.3 From 442fdac531a6b042a396eafc096811e46bc063ca Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 31 Oct 2023 17:38:44 +0100 Subject: check if git dir before doing anything --- bin/extra/supd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index e8eacd4..61ea144 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -17,9 +17,10 @@ fi for dir in $dirs do - printf '%s:' "$dir" | >&2 sed "s#$HOME#~#" ( cd "$dir" || return + git rev-parse > /dev/null 2>&1 || return + printf '%s:' "$dir" | >&2 sed "s#$HOME#~#" git "${1:-fetch}" > /dev/null 2>&1 && printf ' o' || printf ' x' -- cgit v1.2.3 From b7c4d89004f6c493fc0acdbf8b26cae1857b4eb1 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 1 Nov 2023 22:45:27 +0100 Subject: fix typo --- bin/extra/supd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index 61ea144..9adfcf6 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -27,7 +27,7 @@ do # Show remote state printf '%s %s\n' "$(git status --short 2> /dev/null | awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null | - awk -F '[][]' '/^\*/ {print $2}')" | - sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g' + awk -F '[][]' '/^\*/ {print $2}' | + sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g')" ) done -- cgit v1.2.3 From e00713823b3dbd52f7ea15b5d7f7371d78142e16 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 1 Nov 2023 22:45:41 +0100 Subject: exit if command failed --- bin/extra/supd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index 9adfcf6..dba4910 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -19,11 +19,16 @@ for dir in $dirs do ( cd "$dir" || return + # is git dir git rev-parse > /dev/null 2>&1 || return printf '%s:' "$dir" | >&2 sed "s#$HOME#~#" - git "${1:-fetch}" > /dev/null 2>&1 && - printf ' o' || + if git "${1:-fetch}" > /dev/null 2>&1 + then + printf ' o' + else printf ' x' + return + fi # Show remote state printf '%s %s\n' "$(git status --short 2> /dev/null | awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null | -- cgit v1.2.3 From 5265e4a51c9b76537f6c7766e5edbb1f20e56da4 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 1 Nov 2023 22:47:04 +0100 Subject: put status in braces --- bin/extra/supd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index dba4910..2e1f968 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -30,8 +30,8 @@ do return fi # Show remote state - printf '%s %s\n' "$(git status --short 2> /dev/null | - awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null | + printf ' %s %s\n' "$(git status --short 2> /dev/null | + awk 'NR==1 {print "(" $1 ")"}')" "$(git branch -v 2>/dev/null | awk -F '[][]' '/^\*/ {print $2}' | sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g')" ) -- cgit v1.2.3 From 7ff4c5b211129724c451831cefadd55cb55293dd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 1 Nov 2023 22:48:08 +0100 Subject: changed markup --- bin/extra/supd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index 2e1f968..019dd51 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -21,16 +21,16 @@ do cd "$dir" || return # is git dir git rev-parse > /dev/null 2>&1 || return - printf '%s:' "$dir" | >&2 sed "s#$HOME#~#" + printf '%s: ' "$dir" | >&2 sed "s#$HOME#~#" if git "${1:-fetch}" > /dev/null 2>&1 then - printf ' o' + printf 'o' else - printf ' x' + printf 'x' return fi # Show remote state - printf ' %s %s\n' "$(git status --short 2> /dev/null | + printf ' %s%s\n' "$(git status --short 2> /dev/null | awk 'NR==1 {print "(" $1 ")"}')" "$(git branch -v 2>/dev/null | awk -F '[][]' '/^\*/ {print $2}' | sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g')" -- cgit v1.2.3 From b9f5c4e8dcdd209933aa202444a40c1b0d9e542f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 1 Nov 2023 22:49:22 +0100 Subject: fixed markup --- bin/extra/supd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index 019dd51..c7e4e8c 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -26,7 +26,7 @@ do then printf 'o' else - printf 'x' + printf 'x\n' return fi # Show remote state -- cgit v1.2.3 From dec1dcab6fe895b63041380d6fce18436ce593bb Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 15:01:54 +0100 Subject: specify bash --- bin/extra/cht.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/extra/cht.sh b/bin/extra/cht.sh index 681fc69..f373e55 100755 --- a/bin/extra/cht.sh +++ b/bin/extra/cht.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # shellcheck disable=SC1117,SC2001 # # [X] open section -- cgit v1.2.3 From db297fade552c6252581d4f8788e5056352f835d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 15:02:26 +0100 Subject: only forward one port --- bin/extra/aivpn | 6 ------ 1 file changed, 6 deletions(-) (limited to 'bin') diff --git a/bin/extra/aivpn b/bin/extra/aivpn index fd72ffb..3c87ce8 100755 --- a/bin/extra/aivpn +++ b/bin/extra/aivpn @@ -33,9 +33,3 @@ ssh vm "rasdial \"vpn.student.ehb.be\"" ssh -f -N \ -L 2222:10.2.160.41:22 \ vm - -ssh -t \ - -L 8188:localhost:8188 \ - vm \ - ssh -N -L 8188:localhost:8188 luca@10.2.160.41 -logn "[8188], [2222]" -- cgit v1.2.3 From d9a8d6f268a3c0bbf9e24da0737d4af9abbadec0 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 17:42:50 +0100 Subject: still parse status info if the command failed --- bin/extra/supd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index c7e4e8c..9a5ce0c 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -20,19 +20,19 @@ do ( cd "$dir" || return # is git dir - git rev-parse > /dev/null 2>&1 || return - printf '%s: ' "$dir" | >&2 sed "s#$HOME#~#" - if git "${1:-fetch}" > /dev/null 2>&1 + if ! git rev-parse > /dev/null 2>&1 then - printf 'o' - else printf 'x\n' - return + exit fi + printf '%s: ' "$dir" | >&2 sed "s#$HOME#~#" + git "${1:-fetch}" > /dev/null 2>&1 && + printf 'o' || + printf 'x' # Show remote state printf ' %s%s\n' "$(git status --short 2> /dev/null | awk 'NR==1 {print "(" $1 ")"}')" "$(git branch -v 2>/dev/null | awk -F '[][]' '/^\*/ {print $2}' | - sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g')" + sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*//g')" ) done -- cgit v1.2.3 From 8422757706462fd4abe65187902d5590942f0cc9 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 17:43:13 +0100 Subject: added cliptype --- bin/guiscripts/cliptype | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 bin/guiscripts/cliptype (limited to 'bin') diff --git a/bin/guiscripts/cliptype b/bin/guiscripts/cliptype new file mode 100755 index 0000000..e6ac093 --- /dev/null +++ b/bin/guiscripts/cliptype @@ -0,0 +1,2 @@ +#!/bin/sh +clipo | ydotool type -f - -- cgit v1.2.3 From 53cb3d537303c75ac5d3de577075928b687d240a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 17:58:22 +0100 Subject: added clipswap --- bin/guiscripts/clipswap | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 bin/guiscripts/clipswap (limited to 'bin') diff --git a/bin/guiscripts/clipswap b/bin/guiscripts/clipswap new file mode 100755 index 0000000..1cae135 --- /dev/null +++ b/bin/guiscripts/clipswap @@ -0,0 +1,4 @@ +#!/bin/sh +paste="$(clipo)" +clipo -p | clipp +printf '%s' "$paste" | clipp -p -- cgit v1.2.3 From d6cda512a3d6450b88fcd99b5d95addc768bc05c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 18:07:08 +0100 Subject: made ask use tgpt --- bin/common/ask | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'bin') diff --git a/bin/common/ask b/bin/common/ask index 9fb04ce..95530f5 100755 --- a/bin/common/ask +++ b/bin/common/ask @@ -1,36 +1,4 @@ #!/bin/sh - -# requirements -which pass jq > /dev/null || - exit 1 - -# input -test -z "${inp:=$@}" && - inp="$(cat /dev/stdin)" - -# \n\t -> ' ' && "->' -prompt="$(echo "$inp" | tr "\n\t\"" " '")" -test -z "$prompt" && exit 1 - -API_KEY="$(pass tokens/openai-api)" -model="text-davinci-003" -tokens="1024" -temperature=0 - -data=$(echo \ -'{ - "prompt": "'"$prompt"'", - "model": "'"$model"'", - "max_tokens": '$tokens', - "temperature": '$temperature' -}') - -output=$(curl -s -X POST \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $API_KEY" \ - -d "$data" \ - https://api.openai.com/v1/completions \ - | jq -r '.choices[0].text') - -# remove newline -echo "${output:1}" +which tgpt >/dev/null || exit 1 +[ "${inp:=$@}" ] || inp="$(cat /dev/stdin)" +tgpt "$inp" -- cgit v1.2.3 From 7d39603f3dab52c5e2212c6c12bc4b951a4de94e Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 18:36:45 +0100 Subject: added primary clipboard support --- bin/guiscripts/clipo | 8 +++++--- bin/guiscripts/clipp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index e3ae714..39994f9 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,4 +1,6 @@ #!/bin/sh -[ "$WAYLAND_DISPLAY" ] && - wl-paste -n || - xclip -o -selection clipboard -r +[ "$1" = "-p" ] && arg='primary' +if [ "$WAYLAND_DISPLAY" ] +then wl-paste -n ${1} +else xclip -o -selection "${arg:-clipboard}" -r +fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index 538f69b..c9e4f51 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,4 +1,6 @@ #!/bin/sh -[ "$WAYLAND_DISPLAY" ] && - wl-copy -n || - xclip -selection clipboard -r +[ "$1" = "-p" ] && arg='primary' +if [ "$WAYLAND_DISPLAY" ] +then wl-copy -n $1 +else xclip -selection "${arg:-clipboard}" -r +fi -- cgit v1.2.3 From 3f3fa5e5c9df7f43507a117b7cdbc2ddabb9d555 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 7 Nov 2023 01:24:40 +0100 Subject: concatenate dir name --- bin/guiscripts/dmfm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/guiscripts/dmfm b/bin/guiscripts/dmfm index d1dd8b8..9485469 100755 --- a/bin/guiscripts/dmfm +++ b/bin/guiscripts/dmfm @@ -2,9 +2,10 @@ while true do + dir="$(printf '%s' "$PWD" | sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g")" file=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' | sort -k 1 -k 2 | cut -f 2- | - commander -xcd -p "$PWD>") + commander -xc -p "$dir") [ "$file" ] || break [ ! -e "$file" ] && continue -- cgit v1.2.3 From 09e3e0945dd31005f10d7cc18ccd5b38fdb58f97 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 10 Nov 2023 11:44:35 +0100 Subject: refactor --- bin/common/targit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/common/targit b/bin/common/targit index ae046ac..ca560b3 100755 --- a/bin/common/targit +++ b/bin/common/targit @@ -1,6 +1,5 @@ #!/bin/sh -pwd=$(pwd) root="$(git rev-parse --show-toplevel)" cd "$root" || exit 1 -file="$(basename "$root" | sed 's/^\.//').tar.gz" -tar czf "$pwd/$file" $(git ls-files) +file="${root##*/}".tar.gz +tar czf "$file" $(git ls-files) -- cgit v1.2.3 From 2f3909181e31fb443c4ad2048a1e886e877e4a5c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 12 Nov 2023 12:30:38 +0100 Subject: put channels in a subfolder --- bin/common/ytclipo | 2 +- config/essentials/zsh/aliases.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 5d86c3f..8997539 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -23,5 +23,5 @@ yt-dlp "$inp" \ -f "b" \ -S "res:1080" \ -P "$HOME/vids/youtube/" \ - -o "%(channel)s - %(title)s.%(ext)s" + -o "%(channel)s/%(title)s.%(ext)s" notify-send "ytclipo" "finished downloading." || : diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh index 5de4803..a166513 100644 --- a/config/essentials/zsh/aliases.sh +++ b/config/essentials/zsh/aliases.sh @@ -282,7 +282,7 @@ alias fzh="tac $HISTFILE | fzf | tee /dev/stderr | clipp" alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl clients -j | jq '\''.[] | select(.pid == {}) | {class, title, workspace, xwayland}'\''"' alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c' alias fzps='fzf --print0 | xargs -0I{}' -alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s - %(title)s.%(ext)s"' +alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s/%(title)s.%(ext)s"' # docker aliases alias dcb='docker build' -- cgit v1.2.3 From cbfda49e578cf18e7f5e605ca5e073fe0a1c0c17 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 12 Nov 2023 17:19:14 +0100 Subject: added appned2mpv --- bin/extra/append2mpv | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/extra/append2mpv (limited to 'bin') diff --git a/bin/extra/append2mpv b/bin/extra/append2mpv new file mode 100755 index 0000000..28c3916 --- /dev/null +++ b/bin/extra/append2mpv @@ -0,0 +1,30 @@ +#!/bin/sh +IPC="/tmp/mpvsocket" + +die () { >&2 printf '%s\n' "$@"; exit 1; } +append_to_mpv() +{ + file="$(readlink -f "$1")" + if [ ! -r "$file" ] + then + >&2 printf '%s\n' "'$file' not found" + return + fi + + echo '{ "command": ["loadfile", "'"$file"'", "append"] }' | + socat - "$IPC" +} + +[ -S "$IPC" ] || die "$IPC is not a socket or doesn't exist" +which socat > /dev/null || exit 1 + + +if [ -t 0 ] +then + append_to_mpv "$1" +else + while read -r file + do + append_to_mpv "$file" + done +fi -- cgit v1.2.3 From 2fd5995ff81e0b1792b5eab3a723d7321dec78cb Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 12 Nov 2023 17:19:48 +0100 Subject: added sgimg --- bin/extra/sgimg | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/extra/sgimg (limited to 'bin') diff --git a/bin/extra/sgimg b/bin/extra/sgimg new file mode 100755 index 0000000..7c1823c --- /dev/null +++ b/bin/extra/sgimg @@ -0,0 +1,6 @@ +#!/bin/sh + +imv "$(find ~/.local/share/gurk/ -type f -printf "%A@\t%p\n" | + sort -n | + tail -n 1 | + cut -f 2-)" -- cgit v1.2.3 From 1dcdf0cdb769296c33737d285ba9008cff0d60ba Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 16 Nov 2023 21:56:12 +0100 Subject: improved compatibility for different frontends Introduces the use of parameter expansion for converting the link, also convert to youtube.com, because this fixes the bug where you couldn't download playlists/channels. --- bin/common/ytclipo | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 8997539..959ee21 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -11,9 +11,13 @@ fi inp="$1" [ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" -# take last link from clipboard -# works when link is from yt-local -inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" +# remove util scheme +inp="${inp#*//}" +# convert to youtube.com/path url +# works for: +# - 'youtu.be/watch?v=xxxxxx' +# - 'https://piped.video/watch?v=xxxxx' +inp="https://youtube.com/${inp#*/}" >&2 printf "inp: %s\n" "$inp" notify-send "ytclipo" "downloading $inp" || : -- cgit v1.2.3