commit 3d0557f4cc7dc2bc4eda53e05e35b43357c7489a
parent 1595862bb1a34a332d24e3a45f2d303014366e2c
Author: mtmn <miro@haravara.org>
Date: Sat, 11 Apr 2026 00:42:26 +0200
todomenu: simplify
Diffstat:
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/modules/mixins/dotfiles/bin/todomenu b/modules/mixins/dotfiles/bin/todomenu
@@ -6,23 +6,18 @@ TODO_FILE="$HOME/misc/notes/nota/todo.txt"
selected=$(awk '{
if (/^[0-9]{4}-[0-9]{2}-[0-9]{2}/) {
- date = $0
getline
if (/^todo:/) {
match($0, /^todo: (.*)/, arr)
- printf "%s [%s]\n", arr[1], date
+ printf "%s\n", arr[1]
}
}
}' "$TODO_FILE" | tac | dmenu "$@")
if [ -n "$selected" ]; then
- # Extract just the text part (remove date part in brackets)
- text_only=${selected% [*]}
-
- # Check if selection matches any existing todo item
- if ! grep -q "^todo: $text_only$" "$TODO_FILE"; then
- printf "\n%s\ntodo: %s" "$(date --rfc-3339=s)" "$text_only" >>"$TODO_FILE"
+ if ! grep -q "^todo: $selected$" "$TODO_FILE"; then
+ printf "\n%s\ntodo: %s" "$(date --rfc-3339=s)" "$selected" >>"$TODO_FILE"
else
- echo "$text_only" | awk '{print $0}' | wl-copy
+ echo "$selected" | awk '{print $0}' | wl-copy
fi
fi