Gotta commit before battery runs out, almost finished!

This commit is contained in:
Lillian Violet 2024-10-23 19:13:18 +02:00
parent 6bf5b9dd08
commit 8d04d9c649

View file

@ -20,24 +20,21 @@
pkgs.writeText "run_jupyter_from_helix.zsh" pkgs.writeText "run_jupyter_from_helix.zsh"
'' ''
#! ~/.nix-profile/bin/zsh #! ~/.nix-profile/bin/zsh
function is_new() { is_new() {
new=true; new=1;
touch /tmp/rjh; touch /tmp/rjh;
cat /tmp/rjh | while read line while IFS="" read -r p || [ -n "$p" ]; do
do if [ $(pwd) = $p ]; then
if [$(pwd) = line]; then new=0;
new=false;
fi fi
done done < /tmp/rjh
echo new; return $new
} }
function send_to_jupyter() { send_to_jupyter() {
if $(is_new); then is_new && zellij run -f -n "jupyter console" -- direnv exec . jupyter console --kernel="$1" -f="/tmp/rjh-$(pwd | tr \"/\" -).json" --ZMQTerminalInteractiveShell.include_other_output=True --ZMQTerminalInteractiveShell.other_output_prefix=''' && zellij action write 29 25
zellij run -f -n "jupyter console" -- direnv exec . jupyter console --kernel="$1" -f="/tmp/rjh-$(pwd | tr \"/\" -).json" --ZMQTerminalInteractiveShell.include_other_output=True --ZMQTerminalInteractiveShell.other_output_prefix=\'\'
pwd >> /tmp/rjh pwd >> /tmp/rjh
fi zellij action write 29 25
zellij write 29 25 # send ctr + w
cat | just send cat | just send
} }
send_to_jupyter send_to_jupyter