fix(yazi): add debug logging and correct portal config
This commit is contained in:
+15
-10
@@ -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 {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
];
|
||||
config.common = {
|
||||
default = ["hyprland"];
|
||||
"org.freedesktop.impl.portal.FileChooser" = "termfilechooser";
|
||||
"org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user