diff options
author | Soispha <soispha@vhack.eu> | 2023-12-28 13:55:56 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-12-28 13:55:56 +0100 |
commit | c4c5c714da2a185d5f890a197b46b48dfb6579dc (patch) | |
tree | e77a8aba65b3a9fa4d191f9eb6973e653e69ca6f /hm/soispha/pkgs/scripts/wrappers/neorg | |
parent | fix(hm/wms/river/init): Also export river env-vars to system user service (diff) | |
download | nixos-config-c4c5c714da2a185d5f890a197b46b48dfb6579dc.tar.gz nixos-config-c4c5c714da2a185d5f890a197b46b48dfb6579dc.zip |
feat(hm/pkgs/scr/neorg): Change the active task and context when opening browser
Diffstat (limited to '')
-rwxr-xr-x | hm/soispha/pkgs/scripts/wrappers/neorg | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts/wrappers/neorg b/hm/soispha/pkgs/scripts/wrappers/neorg index 1173e474..f11772ae 100755 --- a/hm/soispha/pkgs/scripts/wrappers/neorg +++ b/hm/soispha/pkgs/scripts/wrappers/neorg @@ -139,7 +139,35 @@ PROJECT_open_context_in_browser() { context="$1"; [ "$context" ] || die "BUG: No context supplied to PROJECT_open_context_in_browser" + old_context="$(task _get rc.context)"; + # We have ensured that only one task may be active + old_started_task="$(task +ACTIVE _ids)"; + + tracking="$(mktmp)"; + task "project:$context" _ids | xargs task _zshids > "$tracking"; + + while read -r description; do + desc="$(echo "$description" | awk -F: '{print $2}' )"; + if [ "$desc" = "tracking" ]; then + task_id="$(echo "$description" | awk -F: '{print $1}' )"; + notify-send "(Neorg)" "Starting task $context -> $desc"; + task start "$task_id" + task context "$context" + fi + break + done < "$tracking" + + firefox -P "$context" + + task stop "$task_id" + [ "$old_started_task" ] && task start "$old_started_task" + + if [ "$old_context" ]; then + task context "$old_context" + else + task context none + fi } # }}} # Dmenu {{{ |