diff --git a/files/bin/pipe-watcher b/files/bin/pipe-watcher
new file mode 100755
index 0000000..23c6b77
--- /dev/null
+++ b/files/bin/pipe-watcher
@@ -0,0 +1,15 @@
+#!/usr/bin/fish
+
+set pipe $argv[1]
+
+if test (count $argv) -ge 2
+ echo $argv[2]
+end
+
+if [ ! -p $pipe ]
+ exit 1
+end
+
+while [ -p $pipe ]
+ cat $pipe
+end
diff --git a/files/bin/timer b/files/bin/timer
index c5ed34b..2a29273 100755
--- a/files/bin/timer
+++ b/files/bin/timer
@@ -3,17 +3,11 @@
set timer_folder ~/.timer
set activity_lists_folder $timer_folder/activity.lists
set activity_timeclock_file $timer_folder/activity.timeclock
-set activity_i3blocks $timer_folder/activity.i3blocks
+set activity_i3blocks_pipe $timer_folder/activity.i3blocks.fifo
set activity_current_file $timer_folder/activity.current
set activity_timeclock_append_log_folder $timer_folder/activity.timeclock.d
set activity_timeclock_append_log_filename $activity_timeclock_append_log_folder/(date +%Y-%m-%d)-(hostname)
-
-function set_i3blocks_activity_display
- echo $argv[1] > $activity_i3blocks
- pkill -RTMIN+1 i3blocks
-end
-
function parse_activity_timeclock
sort -k2 | uniq \
|begin
@@ -42,10 +36,10 @@ function parse_activity_timeclock
end
if [ $state = 'i' ]
echo $activity > $activity_current_file
- set_i3blocks_activity_display "★ $activity"
+ echo "★ $activity" > $activity_i3blocks_pipe
else
rm $activity_current_file
- set_i3blocks_activity_display "☆"
+ echo "☆" > $activity_i3blocks_pipe
end
end
@@ -69,10 +63,12 @@ end
function begin_activity
echo i (date '+%Y-%m-%d %H:%M:%S') $argv >> $activity_timeclock_append_log_filename
+ echo "★ $argv" > $activity_i3blocks_pipe
end
function end_activity
echo o (date '+%Y-%m-%d %H:%M:%S') >> $activity_timeclock_append_log_filename
+ echo "☆" > $activity_i3blocks_pipe
end
@@ -95,5 +91,3 @@ switch $command
begin_activity 'Arbeit:Uniklinik Köln'
end
-
-merge_timeclock_append_log
diff --git a/tasks/timer.yaml b/tasks/timer.yaml
index 5cdb662..a4c6e74 100644
--- a/tasks/timer.yaml
+++ b/tasks/timer.yaml
@@ -19,3 +19,8 @@
copy:
content: "{{ default_activities | join('\n') }}"
dest: "{{timer_folder}}/activity.lists/10-default"
+
+- name: timer activity i3blocks fifo
+ command: mkfifo "{{timer_folder}}/activity.i3blocks.fifo"
+ args:
+ creates: "{{timer_folder}}/activity.i3blocks.fifo"
diff --git a/templates/i3/i3blocks.config.j2 b/templates/i3/i3blocks.config.j2
index eb78dab..972951e 100644
--- a/templates/i3/i3blocks.config.j2
+++ b/templates/i3/i3blocks.config.j2
@@ -32,10 +32,9 @@ markup=none
# activity
[activity]
-command=cat ~/.timer/activity.i3blocks
-interval=once
+command=~/bin/pipe-watcher "{{timer_folder}}/activity.i3blocks.fifo" ☆
+interval=persist
markup=pango
-signal=1
# hostinfo
[hostinfo]