Adds yazi as file selector

This commit is contained in:
Michel Fedde 2025-05-09 20:21:47 +02:00
parent 45b0d44136
commit 6fc6e0a224
3 changed files with 49 additions and 2 deletions

View file

@ -0,0 +1,39 @@
#!/usr/bin/env sh
# This wrapper script is invoked by xdg-desktop-portal-termfilechooser.
#
# For more information about input/output arguments read `xdg-desktop-portal-termfilechooser(5)`
set -ex
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="yazi"
termcmd='ghostty --working-directory="~/" --title="Yazi-STANDALONE" -e'
if [ "$save" = "1" ]; then
# save a file
set -- --chooser-file="$out" "$path"
elif [ "$directory" = "1" ]; then
# upload files from a directory
set -- --chooser-file="$out" --cwd-file="$out" "$path"
elif [ "$multiple" = "1" ]; then
# upload multiple files
set -- --chooser-file="$out" "$path"
else
# upload only 1 file
set -- --chooser-file="$out" "$path"
fi
command="$termcmd $cmd"
for arg in "$@"; do
# escape double quotes
escaped=$(printf "%s" "$arg" | sed 's/"/\\"/g')
# escape spaces
command="$command \"$escaped\""
done
sh -c "$command"

View file

@ -1,6 +1,13 @@
#!/bin/env sh #!/bin/env sh
addApplications yazi p7zip jq poppler fd ripgrep fzf zoxide imagemagick fuse-archive zip \ addApplications yazi p7zip jq poppler fd ripgrep fzf zoxide imagemagick fuse-archive zip \
blobdrop-git ouch blobdrop-git ouch xdg-desktop-portal-termfilechooser-hunkyburrito-git
addActions "ya pack -i" setupYazi() {
ya pack -i
systemctl --user restart xdg-desktop-portal-termfilechooser
systemctl --user restart xdg-desktop-portal
}
addActions setupYazi

1
.gitignore vendored
View file

@ -35,6 +35,7 @@
!/.config/wal/ !/.config/wal/
!/.config/zathura/ !/.config/zathura/
!/.config/terminal/ !/.config/terminal/
!/.config/xdg-desktop-portal-termfilechooser/
!/.ssh/ !/.ssh/
/.ssh/* /.ssh/*