dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit d122fc610bcec7f2e5124cafa424a42a3356022d
parent c90d4ae4b69c61239560859d1ace46e037100072
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 10 May 2019 09:42:44 -0700

Improve sxiv and youtube utility scripts

Diffstat:
M.config/newsboat/urls | 1+
M.config/sxiv/exec/key-handler | 6+++---
Mbin/youtube-channel-id | 14+++++++++-----
3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/.config/newsboat/urls b/.config/newsboat/urls @@ -140,3 +140,4 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCzFfuU06f327-bnI3lODUNQ you https://www.youtube.com/feeds/videos.xml?channel_id=UCMx-iVKPpKiRPQfc39nXvXw youtube "~youtube: David Lundbek Egholm" https://www.youtube.com/feeds/videos.xml?channel_id=UCUC_2Z23y5wGOVG2X1ulCCg youtube "~youtube: Fasanfjer" https://www.youtube.com/feeds/videos.xml?channel_id=UCR4s1DE9J4DHzZYXMltSMAg youtube "~youtube: HowToBasic" +https://www.youtube.com/feeds/videos.xml?channel_id=UCRUq9jueekA0t4uz_z5LZmA youtube "~youtube: ToolArchive" diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler @@ -1,5 +1,5 @@ #!/bin/sh -while read file +while read -r file do fullpath="$(pwd)/$file" case "$1" in @@ -24,10 +24,10 @@ do "f") convert -flop "$file" "$file" ;; "y") - echo -n "$file" | xclip -selection clipboard && + printf "%s" "$file" | xclip -selection clipboard && notify-send "$file copied to clipboard" & ;; "Y") - echo -n "$fullpath" | xclip -selection clipboard && + printf "%s" "$fullpath" | xclip -selection clipboard && notify-send "$fullpath copied to clipboard" & ;; "d") [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; diff --git a/bin/youtube-channel-id b/bin/youtube-channel-id @@ -1,8 +1,12 @@ #!/usr/bin/env bash +nbcfg=$HOME/.config/newsboat/urls + function help { - echo "Usage: ${0##*/} <youtube-url>" - echo "or: ${0##*/} <youtube-channel-name>" + echo "Usage: ${0##*/} [add] <youtube-url>" + echo "or: ${0##*/} [add] <youtube-channel-name>" + echo "if the optional command 'add' is used, the channel is added to the " + echo "newsboat feed list in $nbcfg" } [ $# -lt 1 ] && help && exit 1 @@ -25,10 +29,10 @@ id="$(curl --silent "$url" | \ name="$(echo "$url" | sed 's/.*\///' )" if [ "$1" = "add" ]; then + mkdir -p "$(dirname "$nbcfg")" echo -n "https://www.youtube.com/feeds/videos.xml?channel_id=${id} " \ - >> ~/.config/newsboat/urls - - echo "youtube \"~youtube: $name\"" >> ~/.config/newsboat/urls + >> "$nbcfg" + echo "youtube \"~youtube: $name\"" >> "$nbcfg" echo "$name ($id) added" else