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:
@@ -271,26 +271,7 @@ in {
|
|||||||
"${modifier}+0" = "exec ${niveumPackages.menu-calc}/bin/=";
|
"${modifier}+0" = "exec ${niveumPackages.menu-calc}/bin/=";
|
||||||
|
|
||||||
"${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}";
|
"${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}";
|
||||||
"${modifier}+Shift+d" = "exec ${
|
"${modifier}+Shift+d" = "exec ${niveumPackages.notemenu}/bin/notemenu";
|
||||||
pkgs.writers.writeDash "notemenu" ''
|
|
||||||
set -efu
|
|
||||||
PATH=$PATH:${
|
|
||||||
lib.makeBinPath [pkgs.rofi pkgs.findutils pkgs.coreutils]
|
|
||||||
}
|
|
||||||
NOTE_DIR=~/cloud/syncthing/obsidian
|
|
||||||
|
|
||||||
cd "$NOTE_DIR"
|
|
||||||
note_file=$({
|
|
||||||
echo diary/$(date -I).md
|
|
||||||
echo diary/$(date -I -d yesterday).md
|
|
||||||
find . ! -name '.*' -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 "$NOTE_DIR" -e "$EDITOR" "$note_file"
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
}";
|
|
||||||
"${modifier}+p" = "exec rofi-pass";
|
"${modifier}+p" = "exec rofi-pass";
|
||||||
"${modifier}+Shift+p" = "exec rofi-pass --insert";
|
"${modifier}+Shift+p" = "exec rofi-pass --insert";
|
||||||
"${modifier}+u" = "exec ${niveumPackages.unicodmenu}/bin/unicodmenu";
|
"${modifier}+u" = "exec ${niveumPackages.unicodmenu}/bin/unicodmenu";
|
||||||
|
|||||||
@@ -307,6 +307,7 @@
|
|||||||
new-mac = pkgs.callPackage packages/new-mac.nix {};
|
new-mac = pkgs.callPackage packages/new-mac.nix {};
|
||||||
nix-git = pkgs.callPackage packages/nix-git.nix {};
|
nix-git = pkgs.callPackage packages/nix-git.nix {};
|
||||||
nix-index-update = pkgs.callPackage packages/nix-index-update.nix {inherit system;};
|
nix-index-update = pkgs.callPackage packages/nix-index-update.nix {inherit system;};
|
||||||
|
notemenu = pkgs.callPackage packages/notemenu.nix {};
|
||||||
opustags = pkgs.callPackage packages/opustags.nix {};
|
opustags = pkgs.callPackage packages/opustags.nix {};
|
||||||
pls = pkgs.callPackage packages/pls.nix {};
|
pls = pkgs.callPackage packages/pls.nix {};
|
||||||
qrpaste = pkgs.callPackage packages/qrpaste.nix {};
|
qrpaste = pkgs.callPackage packages/qrpaste.nix {};
|
||||||
|
|||||||
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