about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-10-18 16:02:05 +0200
committerSoispha <soispha@vhack.eu>2023-10-18 16:02:05 +0200
commitf8d7663239d1734c6cab44ca1fdd2af52a5b01b9 (patch)
treed6bf3c8b067771a0b8bb9ff1ad609df4f3633388
parentchore(hm/conf/taskwarrior/projects): Update (diff)
downloadnixos-config-f8d7663239d1734c6cab44ca1fdd2af52a5b01b9.tar.gz
nixos-config-f8d7663239d1734c6cab44ca1fdd2af52a5b01b9.zip
fix(hm/pkgs/scrs/neorg): Add a fallback check for the neorg_path
-rw-r--r--hm/soispha/pkgs/scripts.nix1
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/neorg5
2 files changed, 5 insertions, 1 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix
index e36ae62e..4124cf60 100644
--- a/hm/soispha/pkgs/scripts.nix
+++ b/hm/soispha/pkgs/scripts.nix
@@ -52,6 +52,7 @@
     replacementStrings = {
       DEFAULT_NEORG_PROJECT_DIR =
         config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces.projects;
+      HOME_TASKRC = "${config.xdg.configHome}/task/home-manager-taskrc";
     };
   };
   update-sys-scr = write_script {
diff --git a/hm/soispha/pkgs/scripts/wrappers/neorg b/hm/soispha/pkgs/scripts/wrappers/neorg
index 4d35ea32..142924ef 100755
--- a/hm/soispha/pkgs/scripts/wrappers/neorg
+++ b/hm/soispha/pkgs/scripts/wrappers/neorg
@@ -40,7 +40,10 @@ open_current_task_context() {
     current_context="$(task _get rc.context)";
     if [ "$current_context" ]; then
         context_path="$(task _get rc.context."$current_context".rc.neorg_path)";
-        [ "$context_path" ] || die "All contexts should have a 'neorg_path' set!"
+        if ! [ "$context_path" ]; then
+            context_path="$(grep "context.$current_context.rc.neorg_path" "%HOME_TASKRC" | awk 'BEGIN {FS="="} {print $2}')";
+            [ "$context_path" ] || die "All contexts should have a 'neorg_path' set!"
+        fi
 
         # Perform shell expansion of Tilde
         nvim "$(sed "s|~|$HOME|" "$(ptmp "%DEFAULT_NEORG_PROJECT_DIR/$context_path")")";