fix(yazi): add debug logging and correct portal config

This commit is contained in:
kenji
2026-01-11 10:49:43 -06:00
parent 63becaaa09
commit f28ed60390
2 changed files with 16 additions and 11 deletions
+15 -10
View File
@@ -4,29 +4,34 @@
...
}: let
yazi-picker = pkgs.writeShellScriptBin "yazi-picker" ''
echo "--- $(date) ---" >> /tmp/yazi-picker.log
echo "Args: $@" >> /tmp/yazi-picker.log
path="$1"
[ -z "$path" ] && path="."
if [ "$2" = "true" ]; then
# Save file mode
# In save mode, we might want to just open the directory,
# but yazi --chooser-file works for picking a file to overwrite or a directory.
# For a "Save As" flow where you type a name, standard yazi chooser might be limited
# without custom lua, but selecting a directory works.
# For now, treat same as open.
:
echo "Mode: Save" >> /tmp/yazi-picker.log
# Future: handle save mode better (maybe prompts?)
else
echo "Mode: Open" >> /tmp/yazi-picker.log
fi
out="$HOME/.cache/yazi-chooser"
rm -f "$out"
# We need to block until ghostty closes, or use --wait if available/default behavior.
# Ghostty -e does not automatically detach, so it should block.
echo "Launching ghostty..." >> /tmp/yazi-picker.log
${pkgs.ghostty}/bin/ghostty --class="yazi-picker" --title="File Picker" -e ${pkgs.yazi}/bin/yazi "$path" --chooser-file="$out"
ret=$?
echo "Ghostty exited with $ret" >> /tmp/yazi-picker.log
if [ -f "$out" ]; then
cat "$out"
selected=$(cat "$out")
echo "Selected: $selected" >> /tmp/yazi-picker.log
echo "$selected"
rm "$out"
else
echo "No selection" >> /tmp/yazi-picker.log
fi
'';
in {