Adds yazi as file selector
This commit is contained in:
parent
45b0d44136
commit
6fc6e0a224
3 changed files with 49 additions and 2 deletions
39
.config/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh
Executable file
39
.config/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh
Executable 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"
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
#!/bin/env sh
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue