If you're unfamiliar with rofi:
It's a popup window switcher roughly based on superswitcher, requiring only xlib and pango
Rofi has multiple modes.
Using script
mode, one can extend the rofi. There are plenty scripts
other there. you should definitely check them out.
Script modi can be enabled using name:script
syntax. Just save the following
script somewhere in your PATH
directory like /usr/local/bin
, make sure it's
executable and run the following:
rofi -modi TODO:/usr/local/bin/rofi_todo.sh -key-todo SuperL+t
#!/bin/bash
TODO_FILE=~/.rofi_todos
if [[ ! -a "${TODO_FILE}" ]]; then
touch "${TODO_FILE}"
fi
function list_todos()
{
TODO=$(cat "${TODO_FILE}")
if [[ -z "${TODO}" ]]; then
TODDO="\n"
fi
echo "${TODO}"
}
if [ -z "$@" ]
then
list_todos
else
TODO=$(echo "${@}" | sed "s/\([^a-zA-Z0-9]\)/\\\\\\1/g")
TODO_UNSCAPED=${@}
MATCHING=$(grep "^${TODO}$" "${TODO_FILE}")
if [[ -n "${MATCHING}" ]]; then
sed -i "/^${TODO}$/d" "${TODO_FILE}"
else
echo -e "`date +"%B %d %H:%M"` ${TODO_UNSCAPED}" >> "${TODO_FILE}"
fi
list_todos
fi
Instructions: - To Add new TODO, just type it (It should be Unique, BTW) at TODO prompt - To Delete one, Just Select the one and hit Enter
If you're already using rofi, just add TODO
modi to your existing command-line:
rofi -modi DRun,Run,Window,TODO:/usr/local/bin/rofi_todo.sh -key-todo SuperL+t -show TODO