summaryrefslogtreecommitdiffstats
path: root/.config/polybar/focus
diff options
context:
space:
mode:
authorYigit Sever2019-03-17 23:09:49 +0300
committerYigit Sever2019-03-17 23:18:28 +0300
commitea211500227aa58f5e495777743c5d391cbc3110 (patch)
treeafa2b455f9fea40b45dbf8a742c0d0d498024edb /.config/polybar/focus
downloaddotfiles-ea211500227aa58f5e495777743c5d391cbc3110.tar.gz
dotfiles-ea211500227aa58f5e495777743c5d391cbc3110.tar.bz2
dotfiles-ea211500227aa58f5e495777743c5d391cbc3110.zip
Initial commit
Diffstat (limited to '.config/polybar/focus')
-rwxr-xr-x.config/polybar/focus42
1 files changed, 42 insertions, 0 deletions
diff --git a/.config/polybar/focus b/.config/polybar/focus
new file mode 100755
index 0000000..0cccea4
--- /dev/null
+++ b/.config/polybar/focus
@@ -0,0 +1,42 @@
1#!/usr/bin/env perl
2# shows active taskwarrior task on polybar
3#Copyright © 2019 yourname
4
5#This program is free software: you can redistribute it and/or modify
6#it under the terms of the GNU General Public License as published by
7#the Free Software Foundation, either version 3 of the License, or
8#(at your option) any later version.
9
10#This program is distributed in the hope that it will be useful,
11#but WITHOUT ANY WARRANTY; without even the implied warranty of
12#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13#GNU General Public License for more details.
14
15#You should have received a copy of the GNU General Public License
16#along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18use strict;
19use warnings;
20use IO::CaptureOutput qw/capture_exec/;
21
22my ($stdout, $stderr, $success, $exit_code) = capture_exec("task active");
23
24#print("out: $stdout\nerr: $stderr\nexit_code: $exit_code\n");
25
26if ($stderr =~ /No matches\./) {
27 system 'echo "What a beautiful day"';
28 exit;
29}
30my $active_task_maybe = $stdout;
31
32$active_task_maybe =~ s/^\s+|\s+$//g;
33
34my @lines = split /\n/, $active_task_maybe;
35
36my $task = $lines[2];
37$task =~ s/^\s+|\s+$//g;
38$task =~ s/\s+/ /g;
39
40if ($task =~ m/.*?next (.*)$/) {
41 print "$1";
42}