diff options
author | Yigit Sever | 2024-08-30 09:54:37 +0200 |
---|---|---|
committer | Yigit Sever | 2024-08-30 09:54:37 +0200 |
commit | 41611af98e3b501ab0b83e13e215fe163a2318eb (patch) | |
tree | 566d5b31eb4073c9abdc788cd593dbafaa6f17ab /.config/polybar/scripts | |
parent | 36c316b53476fff406db292a54f3c88b07b4b944 (diff) | |
download | dotfiles-41611af98e3b501ab0b83e13e215fe163a2318eb.tar.gz dotfiles-41611af98e3b501ab0b83e13e215fe163a2318eb.tar.bz2 dotfiles-41611af98e3b501ab0b83e13e215fe163a2318eb.zip |
focus: taskwarrior sql guard and capture::tiny
Diffstat (limited to '.config/polybar/scripts')
-rwxr-xr-x | .config/polybar/scripts/focus | 12 |
1 files changed, 10 insertions, 2 deletions
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 @@ | |||
17 | 17 | ||
18 | use strict; | 18 | use strict; |
19 | use warnings; | 19 | use warnings; |
20 | use IO::CaptureOutput qw/capture_exec/; | 20 | use Capture::Tiny ':all'; |
21 | 21 | ||
22 | my ($stdout, $stderr, $success, $exit_code) = capture_exec("task custom_focus"); | 22 | my ($stdout, $stderr, $exit_code) = capture { |
23 | system("task custom_focus"); | ||
24 | }; | ||
23 | 25 | ||
24 | if ($stderr =~ /No matches\./) { | 26 | if ($stderr =~ /No matches\./) { |
25 | system 'echo "${SEMESTER_THEME}"'; | 27 | system 'echo "${SEMESTER_THEME}"'; |
26 | exit; | 28 | exit; |
27 | } | 29 | } |
30 | |||
31 | if ($stderr =~ /database is locked/) { | ||
32 | system 'echo "${SEMESTER_THEME}"'; | ||
33 | exit; | ||
34 | } | ||
35 | |||
28 | my $active_task_maybe = $stdout; | 36 | my $active_task_maybe = $stdout; |
29 | 37 | ||
30 | $active_task_maybe =~ s/^\s+|\s+$//g; | 38 | $active_task_maybe =~ s/^\s+|\s+$//g; |