diff options
| author | joott <josh@ottmail.me> | 2025-07-31 09:46:45 -0400 |
|---|---|---|
| committer | joott <josh@ottmail.me> | 2025-07-31 09:46:45 -0400 |
| commit | 83aac504915a78d49ef01133940de7065e7747a9 (patch) | |
| tree | 3256d8de032893bf57b29aae8d27610c81b08d1d /notepicker | |
| parent | 4550ce81de4ba6c11529c84e2c66224971251a89 (diff) | |
| download | bin-83aac504915a78d49ef01133940de7065e7747a9.tar.gz bin-83aac504915a78d49ef01133940de7065e7747a9.zip | |
initial scripts
Diffstat (limited to 'notepicker')
| -rwxr-xr-x | notepicker | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/notepicker b/notepicker new file mode 100755 index 0000000..95126da --- /dev/null +++ b/notepicker @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# pass in notes directory as parameter +NOTEDIR=$1 +SUFFIX='' + +opennote () { + kitty --directory $NOTEDIR$SUFFIX nvim $notefile +} + +journal () { + cd journal + SUFFIX=/journal + choice=$(echo -e "New\n$(ls -1 *.md)" | rofi -dmenu -p "Entries") || exit 0 + + case $choice in + New) notefile=$(date +%F_%T.md | tr ':' '-'); opennote ;; + *.md) notefile=$choice; opennote ;; + *) exit 0 ;; + esac +} + +pick () { + cd $NOTEDIR + choice=$(echo -e "Journal\n$(ls -t1 *.md)" | rofi -dmenu -p "Notes") || exit 0 + + case $choice in + Journal) journal ;; + *.md) notefile=$choice; opennote ;; + *!) notefile=$(echo $choice | tr -d '!').md; opennote ;; + *) exit 0 ;; + esac +} + +pick |