From adff3817724775005dd9d0927826bcf2d5274b05 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 8 May 2018 16:17:56 +0100 Subject: [PATCH] Add archNews block --- i3/blocks/archNews | 34 ++++++++++++++++++++++++++++++++++ i3/i3blocks.conf | 5 +++++ 2 files changed, 39 insertions(+) create mode 100755 i3/blocks/archNews diff --git a/i3/blocks/archNews b/i3/blocks/archNews new file mode 100755 index 00000000..ac1f9636 --- /dev/null +++ b/i3/blocks/archNews @@ -0,0 +1,34 @@ +#!/usr/bin/sh + +# This shows the most recent part news article in the arch news rss feed +# Left-clicking will open the web page in the browser +# Right clicking will dismiss the feed by putting the title in the ~/.archNewsDismiss file +# Deleting / changing this file will un-dismiss the news item + +title=$(rsstail -u https://www.archlinux.org/feeds/news/ -n 1 -1 | sed -e "s/^Title: //") + +dismissed="" +if [ -f ~/.archNewsDismiss ]; then + dismissed=$(head -n 1 ~/.archNewsDismiss) +fi + +case $BLOCK_BUTTON in + 1) + url=$(rsstail -u https://www.archlinux.org/feeds/news/ -l -n 1 -1 | tail -n 1 | sed -e "s/^Link: //") + case $( uname -s ) in + Darwin) open=open;; + MINGW*) open=start;; + CYGWIN*) open=cygstart;; + MSYS*) open="powershell.exe –NoProfile Start";; + *) open=${BROWSER:-xdg-open};; + esac + $open $url > /dev/null + ;; + 3) + echo $title > ~/.archNewsDismiss + dismissed=$title +esac + +if [ "$dismissed" != "$title" ]; then + echo $title +fi diff --git a/i3/i3blocks.conf b/i3/i3blocks.conf index ff7bcf1a..88d63f02 100644 --- a/i3/i3blocks.conf +++ b/i3/i3blocks.conf @@ -155,6 +155,11 @@ interval=10 command=acpi | cut -d " " -f3-5 | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g" interval=5 +[archNews] +command=~/.dotfiles/i3/blocks/archNews +interval=3600 +color=#FF0000 + # Date Time # [time]