diff --git a/apps/firefox/default.nix b/apps/firefox/default.nix index c5bc057..e103f4a 100644 --- a/apps/firefox/default.nix +++ b/apps/firefox/default.nix @@ -44,7 +44,7 @@ unbind " Hint images and save using Yazi picker - bind ;s hint -i -c native yazi-img-save + bind ;y hint -i -c native yazi-img-save " Force Tridactyl to yield new tab control to Firefox/Extensions set newtab about:newtab diff --git a/apps/yazi/default.nix b/apps/yazi/default.nix index 0559a4e..2b5cbde 100644 --- a/apps/yazi/default.nix +++ b/apps/yazi/default.nix @@ -4,37 +4,28 @@ ... }: let yazi-img-save = pkgs.writeShellScriptBin "yazi-img-save" '' + echo "--- $(date) ---" >> /tmp/yazi-save.log + echo "Args: $@" >> /tmp/yazi-save.log + url="$1" if [ -z "$url" ]; then ${pkgs.libnotify}/bin/notify-send "Yazi Save" "No URL provided" + echo "Error: No URL provided" >> /tmp/yazi-save.log exit 1 fi # Create a temp file to store the chosen directory out=$(mktemp) - - # Launch Yazi in a terminal to pick a directory. - # We use a trick: --chooser-file normally picks a file. - # But if we want a directory, we can select a directory entry (if inside parent) - # OR we can just use the current directory when yazi exits? - # - # Better approach: Use a specific yazi command or just open yazi - # and have a keybind to "pick here"? - # - # Simplest valid approach with stock Yazi: - # Use --chooser-file. User navigates to the folder they want, - # enters it, then selects "current directory" (.) if possible? - # Standard Yazi chooser doesn't easily return "current dir". - # - # Alternative: The user selects a FILE in the directory they want, - # and we save alongside it. + echo "Launching ghostty..." >> /tmp/yazi-save.log ${pkgs.ghostty}/bin/ghostty --class="yazi-picker" --title="Pick Save Folder" -e ${pkgs.yazi}/bin/yazi . --chooser-file="$out" if [ -f "$out" ]; then selected=$(cat "$out") rm "$out" + echo "Selected: $selected" >> /tmp/yazi-save.log + if [ -n "$selected" ]; then # If selected is a file, get its directory. if [ -f "$selected" ]; then @@ -45,22 +36,29 @@ # fallback target_dir="$HOME/Downloads" fi + + echo "Target Dir: $target_dir" >> /tmp/yazi-save.log ${pkgs.libnotify}/bin/notify-send "Downloading..." "$url" # Download cd "$target_dir" + echo "Downloading with wget..." >> /tmp/yazi-save.log ${pkgs.wget}/bin/wget --content-disposition --no-clobber "$url" ret=$? if [ $ret -eq 0 ]; then ${pkgs.libnotify}/bin/notify-send "Download Complete" "Saved to $target_dir" + echo "Download success" >> /tmp/yazi-save.log else ${pkgs.libnotify}/bin/notify-send -u critical "Download Failed" "wget exit code: $ret" + echo "Download failed: $ret" >> /tmp/yazi-save.log fi else - echo "No selection" + echo "No selection made" >> /tmp/yazi-save.log fi + else + echo "No output file" >> /tmp/yazi-save.log fi ''; in {