summaryrefslogtreecommitdiffstats
path: root/.config/polybar/scripts
diff options
context:
space:
mode:
Diffstat (limited to '.config/polybar/scripts')
-rwxr-xr-x.config/polybar/scripts/focus12
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
18use strict; 18use strict;
19use warnings; 19use warnings;
20use IO::CaptureOutput qw/capture_exec/; 20use Capture::Tiny ':all';
21 21
22my ($stdout, $stderr, $success, $exit_code) = capture_exec("task custom_focus"); 22my ($stdout, $stderr, $exit_code) = capture {
23 system("task custom_focus");
24};
23 25
24if ($stderr =~ /No matches\./) { 26if ($stderr =~ /No matches\./) {
25 system 'echo "${SEMESTER_THEME}"'; 27 system 'echo "${SEMESTER_THEME}"';
26 exit; 28 exit;
27} 29}
30
31if ($stderr =~ /database is locked/) {
32 system 'echo "${SEMESTER_THEME}"';
33 exit;
34}
35
28my $active_task_maybe = $stdout; 36my $active_task_maybe = $stdout;
29 37
30$active_task_maybe =~ s/^\s+|\s+$//g; 38$active_task_maybe =~ s/^\s+|\s+$//g;