taskd - display upcoming tasks

Submitted scripts and programs
Forum rules
Your own work only.
User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

taskd - display upcoming tasks

Unread post by dkeg » Wed Dec 24, 2014 3:33 pm

Okay, I got it. Not elegant, that's for sure, but it works right.
I already have a 'notifications' script that I use for keeping scripts to run on start as functions, i.e. battery and now taskd.

In .xinitrc

Code: Select all

sleep 2s && while :; do notifications; sleep 450; done &
Notification script is like this

Code: Select all

#! /bin/bash
...
function taskd {
## taskd; a simple script to iterate
## over the next few tasks
## dkeg 2014

## Task file location
file="$HOME/.when/calendar"
tmp="$HOME/.when/taskdump"

## grab upcoming tasks
today=$(when | awk 'NR==3 {$2=$3=$4="";print}')
tomorrow=$(when | awk 'NR==4 {$2=$3=$4="";print}')
upcoming=$(when | awk 'NR==5 {$2="";print}')

## How long of a delay
#delay=$(sleep 6)

## Loop the file, display the tasks I want in intervals
    while :; do
        sleep 5; echo $today > $tmp
        sleep 30; echo $tomorrow > $tmp
        sleep 60; echo $upcoming > $tmp
    done
}
sleep 3s && battery
sleep 1s && taskd
#sleep 200s && stats
#sleep 20s && song
and in my stats bar the relevant call is

Code: Select all

taskd() {
    awk  'NR==1 {print}' $HOME/.when/taskdump                       
}
So for now it works, iteratively displaying my next 3 tasks in my statusbar. I'm sure I'll tweak a bit to better suit my needs; like timing, etc. With the original script, one could use a notification system like dunst or 'pop', call on keybind, or send to the cat, but I wanted to make use of what was already displaying.

Thanks for your help MB. It was like a virtual whiteboard session.

Work hard; Complain less

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: taskd - display upcoming tasks

Unread post by stark » Fri Dec 26, 2014 11:57 am

Very nice dkeg! And a great notification setup. Thanks for sharing :)
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

Post Reply