2023-07-04 10:12:34 +02:00
|
|
|
{
|
|
|
|
|
writers,
|
|
|
|
|
lib,
|
|
|
|
|
rofi,
|
|
|
|
|
findutils,
|
|
|
|
|
coreutils,
|
2024-04-05 11:41:24 +02:00
|
|
|
noteDirectory ? "~/state/obsidian",
|
2023-07-04 10:12:34 +02:00
|
|
|
currentDates ? false,
|
2025-12-27 22:22:54 +01:00
|
|
|
obsidian-vim,
|
2023-07-04 10:12:34 +02:00
|
|
|
}:
|
|
|
|
|
writers.writeDashBin "notemenu" ''
|
|
|
|
|
set -efu
|
|
|
|
|
PATH=$PATH:${
|
2025-12-27 22:22:54 +01:00
|
|
|
lib.makeBinPath [
|
|
|
|
|
rofi
|
|
|
|
|
findutils
|
|
|
|
|
coreutils
|
|
|
|
|
]
|
2023-07-04 10:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cd ${noteDirectory}
|
|
|
|
|
note_file=$({
|
|
|
|
|
${lib.optionalString currentDates ''
|
2025-12-27 22:22:54 +01:00
|
|
|
echo $(date -I).md
|
|
|
|
|
echo $(date -I -d yesterday).md
|
|
|
|
|
''}
|
2023-07-04 10:12:34 +02:00
|
|
|
find . -not -path '*/.*' -type f -printf "%T@ %p\n" | sort --reverse --numeric-sort | cut --delimiter=" " --fields=2-
|
|
|
|
|
} | rofi -dmenu -i -p 'notes')
|
|
|
|
|
if test "$note_file"
|
|
|
|
|
then
|
2025-12-25 14:00:03 +01:00
|
|
|
alacritty --working-directory ${noteDirectory} -e ${obsidian-vim}/bin/nvim "$note_file"
|
2023-07-04 10:12:34 +02:00
|
|
|
fi
|
|
|
|
|
''
|