From 41611af98e3b501ab0b83e13e215fe163a2318eb Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 30 Aug 2024 09:54:37 +0200 Subject: focus: taskwarrior sql guard and capture::tiny --- .config/polybar/scripts/focus | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to '.config/polybar/scripts/focus') diff --git a/.config/polybar/scripts/focus b/.config/polybar/scripts/focus index 49d46d2..b60ef7b 100755 --- a/.config/polybar/scripts/focus +++ b/.config/polybar/scripts/focus @@ -17,14 +17,22 @@ use strict; use warnings; -use IO::CaptureOutput qw/capture_exec/; +use Capture::Tiny ':all'; -my ($stdout, $stderr, $success, $exit_code) = capture_exec("task custom_focus"); +my ($stdout, $stderr, $exit_code) = capture { + system("task custom_focus"); +}; if ($stderr =~ /No matches\./) { system 'echo "${SEMESTER_THEME}"'; exit; } + +if ($stderr =~ /database is locked/) { + system 'echo "${SEMESTER_THEME}"'; + exit; +} + my $active_task_maybe = $stdout; $active_task_maybe =~ s/^\s+|\s+$//g; -- cgit v1.2.3-70-g09d2