diff options
author | NeodarZ <neodarz@neodarz.ovh> | 2016-09-21 20:01:28 +0200 |
---|---|---|
committer | NeodarZ <neodarz@neodarz.ovh> | 2016-09-21 20:01:28 +0200 |
commit | 78db7d43845d3ea276b8028bec6d67b5a5641a1b (patch) | |
tree | 27a58084c5eac2dc9b084e9f57fd6bc762afc480 /i3/blocks/feed | |
parent | 0cde152bf8483e894eb64c41529c5d8c6349327b (diff) | |
download | dotfiles-78db7d43845d3ea276b8028bec6d67b5a5641a1b.tar.xz dotfiles-78db7d43845d3ea276b8028bec6d67b5a5641a1b.zip |
Ajout de la conf de vim + mise à jour de la structure
Diffstat (limited to 'i3/blocks/feed')
-rwxr-xr-x | i3/blocks/feed | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/i3/blocks/feed b/i3/blocks/feed new file mode 100755 index 0000000..0030939 --- /dev/null +++ b/i3/blocks/feed @@ -0,0 +1,31 @@ +#!/bin/bash + +# WARNING: This has a LIMIT of 32 characters for now! +# If your URL is longer you should use an URL shortener +# Caused by https://github.com/vivien/i3blocks/blob/01a4f4a9ca1e3d0b3c95d1d62000ad8506bdff1a/include/block.h#L50 +# Example: https://goo.gl/ +FEED_URL="${BLOCK_INSTANCE:-https://www.archlinux.org/feeds/news/}" + +if [[ "${FEED_URL}" = "" ]]; then + exit +fi + +# Follows redirects! +FEED_CONTENT=$(curl ${FEED_URL} -s -L) +FEED_TITLE=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '<title>.*</title>' | head -n 1 | sed 's/\(<title>\|<\/title>\)//g') +FEED_LINK=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '<link>.*</link>' | head -n 1 | sed 's/\(<link>\|<\/link>\)//g') + +if [[ "${FEED_TITLE}" = *404* ]]; then + echo "${FEED_URL}" + echo "${FEED_URL}" + echo "" + exit 33 +fi + +if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then + xdg-open "${FEED_LINK}" +fi + +echo "${FEED_TITLE}" +echo "${FEED_TITLE}" +echo ""
\ No newline at end of file |