mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(notemenu): use as flake package
This commit is contained in:
28
packages/notemenu.nix
Normal file
28
packages/notemenu.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
writers,
|
||||
lib,
|
||||
rofi,
|
||||
findutils,
|
||||
coreutils,
|
||||
noteDirectory ? "~/cloud/syncthing/obsidian",
|
||||
currentDates ? false,
|
||||
}:
|
||||
writers.writeDashBin "notemenu" ''
|
||||
set -efu
|
||||
PATH=$PATH:${
|
||||
lib.makeBinPath [rofi findutils coreutils]
|
||||
}
|
||||
|
||||
cd ${noteDirectory}
|
||||
note_file=$({
|
||||
${lib.optionalString currentDates ''
|
||||
echo $(date -I).md
|
||||
echo $(date -I -d yesterday).md
|
||||
''}
|
||||
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
|
||||
alacritty --working-directory ${noteDirectory} -e "$EDITOR" "$note_file"
|
||||
fi
|
||||
''
|
||||
Reference in New Issue
Block a user