[wiki] [sites] simple todo reminder || Thuban

From: <git_AT_suckless.org>
Date: Thu, 20 Jun 2013 10:12:39 +0200

commit 03b8177d5f2390b8c7c4b8822c2faf60f5de707f
Author: Thuban <thuban_AT_singularity.fr>
Date: Thu Jun 20 10:12:36 2013 +0200

    simple todo reminder

diff --git a/tools.suckless.org/dmenu/scripts/index.md b/tools.suckless.org/dmenu/scripts/index.md
index f6418d7..5dfa110 100644
--- a/tools.suckless.org/dmenu/scripts/index.md
+++ b/tools.suckless.org/dmenu/scripts/index.md
_AT_@ -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
new file mode 100755
index 0000000..82dd8c7
--- /dev/null
+++ b/tools.suckless.org/dmenu/scripts/todo
_AT_@ -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
Received on Thu Jun 20 2013 - 10:12:39 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 20 2013 - 10:24:14 CEST