diff options
-rwxr-xr-x | .local/bin/ref-mbsync.pl | 31 | ||||
-rwxr-xr-x | .local/bin/ref-newsboat.pl | 45 |
2 files changed, 76 insertions, 0 deletions
diff --git a/.local/bin/ref-mbsync.pl b/.local/bin/ref-mbsync.pl new file mode 100755 index 0000000..52b0129 --- /dev/null +++ b/.local/bin/ref-mbsync.pl @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; + +use constant { + MBSYNC_PATH => '/usr/local/bin/mbsync', + NOTIFY_SEND_PATH => '/usr/local/bin/notify-send' +}; + +sub main +{ + system( + NOTIFY_SEND_PATH, + 'mbsync', + '-u', + 'low', + 'Fetching mail...' + ); + system( + MBSYNC_PATH, + '-c', + '/usr/home/jozan/.mbsyncrc', + '-a' + ); + exit 0; +} + +main(); + +__END__ diff --git a/.local/bin/ref-newsboat.pl b/.local/bin/ref-newsboat.pl new file mode 100755 index 0000000..70e2955 --- /dev/null +++ b/.local/bin/ref-newsboat.pl @@ -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__ |