From fc43a6cb38a99c39bc601faa49408ad1bf370955 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 27 Oct 2021 19:27:12 +0200 Subject: new name --- .local/bin/ref-newsboat | 45 +++++++++++++++++++++++++++++++++++++++++++++ .local/bin/ref-newsboat.pl | 45 --------------------------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) create mode 100755 .local/bin/ref-newsboat delete mode 100755 .local/bin/ref-newsboat.pl (limited to '.local') diff --git a/.local/bin/ref-newsboat b/.local/bin/ref-newsboat new file mode 100755 index 0000000..baebdeb --- /dev/null +++ b/.local/bin/ref-newsboat @@ -0,0 +1,45 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use Capture::Tiny qw(capture); + +use constant { + NEWSBOAT_PATH => '/usr/local/bin/newsboat', + NOTIFY_SEND_PATH => '/usr/local/bin/notify-send' +}; + +sub main +{ + my $stdout; + if (system( + NEWSBOAT_PATH, + '-x', + 'reload' + ) != 0) { + exit 1; + } + ($stdout, undef, undef) = capture { + system( + NEWSBOAT_PATH, + '-x', + 'print-unread' + ); + }; + $stdout =~ s/\s.+//; + chomp $stdout; + if ($stdout != 0) { + system( + NOTIFY_SEND_PATH, + '-u', + 'low', + 'newsboat', + ' ' . $stdout . ' new articles' + ); + } + exit 0; +} + +main(); + +__END__ diff --git a/.local/bin/ref-newsboat.pl b/.local/bin/ref-newsboat.pl deleted file mode 100755 index baebdeb..0000000 --- a/.local/bin/ref-newsboat.pl +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/local/bin/perl - -use strict; -use warnings; -use Capture::Tiny qw(capture); - -use constant { - NEWSBOAT_PATH => '/usr/local/bin/newsboat', - NOTIFY_SEND_PATH => '/usr/local/bin/notify-send' -}; - -sub main -{ - my $stdout; - if (system( - NEWSBOAT_PATH, - '-x', - 'reload' - ) != 0) { - exit 1; - } - ($stdout, undef, undef) = capture { - system( - NEWSBOAT_PATH, - '-x', - 'print-unread' - ); - }; - $stdout =~ s/\s.+//; - chomp $stdout; - if ($stdout != 0) { - system( - NOTIFY_SEND_PATH, - '-u', - 'low', - 'newsboat', - ' ' . $stdout . ' new articles' - ); - } - exit 0; -} - -main(); - -__END__ -- cgit v1.2.3