about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-03-07 15:43:01 +0100
committerSoispha <soispha@vhack.eu>2024-03-07 15:43:01 +0100
commitd475107efb16535f03e0409bce3809233fbc1478 (patch)
tree72b183c3076a63fa55675ebc53a9e5091417d1a2
parentfix(pkgs/scripts/aumo): Add required dependencies (and remove old ones) (diff)
downloadnixos-config-d475107efb16535f03e0409bce3809233fbc1478.tar.gz
nixos-config-d475107efb16535f03e0409bce3809233fbc1478.zip
feat(pkgs/scripts/neorg/review): Only review opened projects
-rw-r--r--sys/nixpkgs/pkgs/scripts/default.nix1
-rwxr-xr-xsys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/dmenu.sh2
-rwxr-xr-xsys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/review.sh9
3 files changed, 9 insertions, 3 deletions
diff --git a/sys/nixpkgs/pkgs/scripts/default.nix b/sys/nixpkgs/pkgs/scripts/default.nix
index 094dae68..477f5f5b 100644
--- a/sys/nixpkgs/pkgs/scripts/default.nix
+++ b/sys/nixpkgs/pkgs/scripts/default.nix
@@ -250,6 +250,7 @@
           DEFAULT_NEORG_PROJECT_DIR =
             config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces.projects;
           HOME_TASKRC = "${config.xdg.configHome}/task/home-manager-taskrc";
+          NEORG_REVIEW_PATH = "${config.xdg.configHome}/neorg/review";
           ALL_PROJECTS_NEWLINE = "${config.soispha.taskwarrior.projects.projects_newline}";
           ALL_PROJECTS_COMMA = "${config.soispha.taskwarrior.projects.projects_comma}";
           ALL_PROJECTS_PIPE = "${config.soispha.taskwarrior.projects.projects_pipe}";
diff --git a/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/dmenu.sh b/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/dmenu.sh
index 73e9460a..5a138982 100755
--- a/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/dmenu.sh
+++ b/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/dmenu.sh
@@ -4,6 +4,8 @@ dmenu0open_context_in_browser() {
     project="$(echo "%ALL_PROJECTS_PIPE" | rofi -sep "|" -dmenu)"
 
     if [ "$project" ]; then
+        [ -d "%NEORG_REVIEW_PATH" ] || mkdir --parents "%NEORG_REVIEW_PATH"
+        [ -f "%NEORG_REVIEW_PATH/$project.lock" ] || touch "%NEORG_REVIEW_PATH/$project.lock"
         project0open_project_in_browser "$project"
     else
         notify-send "(neorg/dmenu) No project selected"
diff --git a/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/review.sh b/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/review.sh
index ab9ec6b1..a0a9ab8d 100755
--- a/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/review.sh
+++ b/sys/nixpkgs/pkgs/scripts/source/specific/neorg/sh/functions/review.sh
@@ -2,8 +2,11 @@
 
 review0start() {
     for project in $(list0list_all_contexts_newline); do
-        msg "Starting '$project'"
-        notify-send "Neorg" "Starting '$project'"
-        firefox -P "$project"
+        if [ -f "%NEORG_REVIEW_PATH/$project.lock" ]; then
+            msg "Reviewing '$project'"
+            notify-send "Neorg" "Reviewing '$project'"
+            firefox -P "$project"
+            rm "%NEORG_REVIEW_PATH/$project.lock"
+        fi
     done
 }