Bladeren bron

smoother timer

pull/1/head
bovenliggende
commit
4ab8e54cdd
4 gewijzigde bestanden met toevoegingen van 27 en 14 verwijderingen
  1. +15
    -0
      files/bin/pipe-watcher
  2. +5
    -11
      files/bin/timer
  3. +5
    -0
      tasks/timer.yaml
  4. +2
    -3
      templates/i3/i3blocks.config.j2

+ 15
- 0
files/bin/pipe-watcher Bestand weergeven

@@ -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

+ 5
- 11
files/bin/timer Bestand weergeven

@@ -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 "<span foreground=\"#00FF00\">★ $activity</span>"
echo "<span foreground=\"#00FF00\">★ $activity</span>" > $activity_i3blocks_pipe
else
rm $activity_current_file
set_i3blocks_activity_display "<span foreground=\"#0000FF\">☆</span>"
echo "<span foreground=\"#0000FF\">☆</span>" > $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 "<span foreground=\"#00FF00\">★ $argv</span>" > $activity_i3blocks_pipe
end

function end_activity
echo o (date '+%Y-%m-%d %H:%M:%S') >> $activity_timeclock_append_log_filename
echo "<span foreground=\"#0000FF\">☆</span>" > $activity_i3blocks_pipe
end


@@ -95,5 +91,3 @@ switch $command
begin_activity 'Arbeit:Uniklinik Köln'

end

merge_timeclock_append_log

+ 5
- 0
tasks/timer.yaml Bestand weergeven

@@ -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"

+ 2
- 3
templates/i3/i3blocks.config.j2 Bestand weergeven

@@ -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]