From b63045a0c09f13b8a6cf255f275e5f2b04f8d020 Mon Sep 17 00:00:00 2001 From: i-c-u-p <96894903+i-c-u-p@users.noreply.github.com> Date: Wed, 15 Jun 2022 15:03:25 +0000 Subject: [PATCH] use "|" as sed delimiter if pattern has "/" (#1118) removes the need for "/" to be escaped with a backslash --- .local/bin/dmenuhandler | 6 +++--- .local/bin/peertubetorrent | 4 ++-- .local/bin/statusbar/sb-clock | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 3e5055f..1c48f3a 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -12,9 +12,9 @@ case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;; "queue yt-dlp audio") qndl "$feed" 'yt-dlp --embed-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; - PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; - sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; - vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; + sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; + vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; lynx) lynx "$feed" >/dev/null 2>&1 ;; diff --git a/.local/bin/peertubetorrent b/.local/bin/peertubetorrent index e89b1c0..4d8f630 100755 --- a/.local/bin/peertubetorrent +++ b/.local/bin/peertubetorrent @@ -3,7 +3,7 @@ # first argument is the video link, second is the quality (360, 480 or 1080) # 13/07/20 - Arthur Bais -instance=$(echo "$1" | sed "s/\/w.\+//") -vidid=$(echo "$1" | sed "s/.\+\///") +instance=$(echo "$1" | sed "s|/w.\+||") +vidid=$(echo "$1" | sed "s|.\+/||") link=$(curl -s "$instance/api/v1/videos/$vidid" | grep -o "$instance/download/torrents/.\{37\}$2.torrent") transadd "$link" diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index d25e8d0..e1ca8c7 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -19,7 +19,7 @@ case "$clock" in esac case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s|..27m||")" && notify-send "Appointments" "$(calcurse -d3)" ;; 2) setsid -f "$TERMINAL" -e calcurse ;; 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;;