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"
''
#! ~/.nix-profile/bin/zsh
function is_new() {
new=true;
is_new() {
new=1;
touch /tmp/rjh;
cat /tmp/rjh | while read line
do
if [$(pwd) = line]; then
new=false;
while IFS="" read -r p || [ -n "$p" ]; do
if [ $(pwd) = $p ]; then
new=0;
fi
done
echo new;
done < /tmp/rjh
return $new
}
function send_to_jupyter() {
if $(is_new); then
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=\'\'
send_to_jupyter() {
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
pwd >> /tmp/rjh
fi
zellij write 29 25 # send ctr + w
zellij action write 29 25
cat | just send
}
send_to_jupyter