sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 03b8177d5f2390b8c7c4b8822c2faf60f5de707f
parent 1197b693128fe1f90ebdb70dfaf64c4141e3cb59
Author: Thuban <thuban@singularity.fr>
Date:   Thu, 20 Jun 2013 10:12:36 +0200

simple todo reminder

Diffstat:
Mtools.suckless.org/dmenu/scripts/index.md | 2++
Atools.suckless.org/dmenu/scripts/todo | 31+++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/dmenu/scripts/index.md b/tools.suckless.org/dmenu/scripts/index.md @@ -9,5 +9,7 @@ Download * [run-recent](run-recent) : List recent commands first. End a command with ";" to run it in e terminal. [source](https://bbs.archlinux.org/viewtopic.php?id=56646&p=12) +* [todo](todo): one task per line. Write a new task, or valid an old + task to remove it. diff --git a/tools.suckless.org/dmenu/scripts/todo b/tools.suckless.org/dmenu/scripts/todo @@ -0,0 +1,31 @@ +#!/bin/sh +# Write/remove a task to do later. +SB="#336699" +SF="#ccc" +NB="#111" +NF="#ccc" +FN="-*-fixed-medium-r-semicondensed-*-13-*-*-*-*-*-iso10646-*" + +FILE=~/.todo +HEIGHT=$(cat $FILE | wc -l) +PROMPT="Add/delete a task" + +ACTION="cat $FILE | dmenu -fn $FN -l '$HEIGHT' -nb '$NB' -nf '$NF' -sb '$SB' -sf '$SF' -p '$PROMPT:' " +CMD=$(eval $ACTION) +while [ -n "$CMD" ]; do + grep -q "^$CMD" $FILE + if [ $? = 0 ]; then + grep -v "^$CMD" $FILE > /tmp/todo + mv /tmp/todo $FILE + HEIGHT=$(($HEIGHT-1)) + ACTION="cat $FILE | dmenu -fn $FN -l '$HEIGHT' -nb '$NB' -nf '$NF' -sb '$SB' -sf '$SF' -p '$PROMPT:' " + else + echo "$CMD" >> $FILE + HEIGHT=$(($HEIGHT+1)) + ACTION="cat $FILE | dmenu -fn $FN -l '$HEIGHT' -nb '$NB' -nf '$NF' -sb '$SB' -sf '$SF' -p '$PROMPT:' " + fi + + CMD=$(eval $ACTION) + +done +exit 0