From e2ee726c851eadeac489b3288f775af234ba4a7a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 10 Dec 2023 15:23:29 +0100 Subject: fixed: only find images --- bin/extra/sgimg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/extra/sgimg b/bin/extra/sgimg index 7c1823c..acb8126 100755 --- a/bin/extra/sgimg +++ b/bin/extra/sgimg @@ -1,6 +1,6 @@ #!/bin/sh -imv "$(find ~/.local/share/gurk/ -type f -printf "%A@\t%p\n" | +imv "$(find ~/.local/share/gurk/ -type f \( -iname '*.png' -o -iname '*.jpg' \) -printf "%A@\t%p\n" | sort -n | tail -n 1 | cut -f 2-)" -- cgit v1.2.3 From 94c9b362faa414e7068f60184e3d01a47b96b823 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 12 Dec 2023 00:10:31 +0100 Subject: added handling file:// scheme --- bin/guiscripts/linkhandler | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin') diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler index aeec202..fb5a3ea 100755 --- a/bin/guiscripts/linkhandler +++ b/bin/guiscripts/linkhandler @@ -11,6 +11,12 @@ test -z "${url:=$1}" && dunstify "linkhandler" "handling $url" case "$url" in + file://*) file="${url##file:/}" + case "$(file -bi "$file" | cut -f1 -d'/')" in + audio|video) mpv "$file" ;; + image) imv "$file" ;; + *) xdg-open "$file" ;; + esac ;; *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) setsid -f mpv --quiet --ytdl --ytdl-raw-options="format-sort=res:720" "$url" > /dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) -- cgit v1.2.3 From e04eb710bbd01c0f6f486c037815687081c21d4b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 12 Dec 2023 00:12:10 +0100 Subject: added ytlink --- bin/common/ytclipo | 19 +------------------ bin/common/ytlink | 14 ++++++++++++++ config/essentials/zsh/aliases.sh | 1 + 3 files changed, 16 insertions(+), 18 deletions(-) create mode 100755 bin/common/ytlink (limited to 'bin') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 959ee21..1a82df2 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -1,23 +1,6 @@ #!/bin/sh -# argument ($1) -> clipboard -> stdin -if [ "$WAYLAND_DISPLAY" ] -then paste() { wl-paste; } -elif [ "$TERMUX_VERSION" ] -then paste() { termux-clipboard-get; } -else paste() { xclip -o -sel c; } -fi - -inp="$1" -[ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" - -# 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#*/}" +inp="$(ytlink)" >&2 printf "inp: %s\n" "$inp" notify-send "ytclipo" "downloading $inp" || : diff --git a/bin/common/ytlink b/bin/common/ytlink new file mode 100755 index 0000000..a5e9bf0 --- /dev/null +++ b/bin/common/ytlink @@ -0,0 +1,14 @@ +#!/bin/sh + +# convert to youtube.com/path url +# works for: +# - 'youtu.be/watch?v=xxxxxx' +# - 'https://piped.video/watch?v=xxxxx' + +inp="$1" +[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" + +# remove util scheme +inp="${inp#*//}" +inp="https://youtube.com/${inp#*/}" +printf "%s" "$inp" diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh index 9c8f7f6..ee7dfd8 100644 --- a/config/essentials/zsh/aliases.sh +++ b/config/essentials/zsh/aliases.sh @@ -284,6 +284,7 @@ alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl cl 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 ytplay='mpv "$(ytlink)"' # emacs aliases alias emacsd='emacs --daemon' -- cgit v1.2.3 From 797c829ac104ee480d4f46d091999d84d6f8c3bd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 12 Dec 2023 00:14:40 +0100 Subject: added file scheme --- bin/guiscripts/sturl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl index c738c8e..17f2beb 100755 --- a/bin/guiscripts/sturl +++ b/bin/guiscripts/sturl @@ -1,7 +1,7 @@ #!/bin/sh -regex='(((https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)' url="$(tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)" +regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)' [ -z "$url" ] && exit 1 case $1 in -- cgit v1.2.3 From 347d3e683e2194b4b59eac3e0343f28089587c10 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 12 Dec 2023 00:14:59 +0100 Subject: cleanup sort results in reverse order so bottom results in terminal are shown first don't use echo --- bin/guiscripts/sturl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl index 17f2beb..5b8b1e7 100755 --- a/bin/guiscripts/sturl +++ b/bin/guiscripts/sturl @@ -1,11 +1,11 @@ #!/bin/sh -url="$(tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)" regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)' +url="$(tr -d '\n' | grep -Eo "$regex" | tac | commander -cl)" [ -z "$url" ] && exit 1 case $1 in - 'c') echo -n "$url" | xclip -sel c -r ;; + 'c') printf '%s' "$url" | xclip -sel c -r ;; 'o') linkhandler "$url" ;; *) echo "no option" ;; esac -- cgit v1.2.3 From c4bc59d1dc75f39114aa023d8f2b9945989a456d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 12 Dec 2023 00:15:35 +0100 Subject: use mpv instead of qndl --- bin/guiscripts/linkhandler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler index fb5a3ea..329e267 100755 --- a/bin/guiscripts/linkhandler +++ b/bin/guiscripts/linkhandler @@ -24,7 +24,7 @@ case "$url" in *pdf|*cbz|*cbr) curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) - qndl "$url" 'curl -LO' >/dev/null 2>&1 ;; + mpv "$url" 'curl -LO' >/dev/null 2>&1 ;; *) if [ -f "$url" ] then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 -- cgit v1.2.3