Fixes config
This commit is contained in:
parent
6fc6e0a224
commit
4a7dc697d7
2 changed files with 8 additions and 39 deletions
8
.config/xdg-desktop-portal-termfilechooser/config
Executable file
8
.config/xdg-desktop-portal-termfilechooser/config
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[filechooser]
|
||||||
|
cmd=yazi-wrapper.sh
|
||||||
|
default_dir=$HOME
|
||||||
|
; Uncomment and edit the line below to change the terminal emulator command
|
||||||
|
env=TERMCMD="ghostty --class=\"YAZI-FILECHOOSER\" -e"
|
||||||
|
; Mode must be one of 'suggested', 'default', or 'last'.
|
||||||
|
open_mode=suggested
|
||||||
|
save_mode=suggested
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
#!/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"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue