working on yazi as file picker
This commit is contained in:
parent
0192c8ed42
commit
c62dd7b8a4
6 changed files with 58 additions and 9 deletions
12
flake.lock
generated
12
flake.lock
generated
|
@ -362,11 +362,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745205007,
|
||||
"narHash": "sha256-k67bEcLkSo13TIBfs0CGYkJjG12aaikabMtxWbSeqr0=",
|
||||
"lastModified": 1745251259,
|
||||
"narHash": "sha256-Hf8WEJMMoP6Fe+k+PYkVJFk5UKory2S0jW7HqRVqQFc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "3fbe9a2b76ff5c4dcb2a2a2027dac31cfc993c8c",
|
||||
"rev": "82ee14ff60611b46588ea852f267aafcc117c8c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1534,11 +1534,11 @@
|
|||
"rust-overlay": "rust-overlay_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745240671,
|
||||
"narHash": "sha256-6r2Qmk7XsZtfPEod9Jh07Wp85bkm10yZi+LqO+GMGR8=",
|
||||
"lastModified": 1745246655,
|
||||
"narHash": "sha256-gB4anxOio0bAJi/GVePLwm8kx7WccFTNiON4y0ASin0=",
|
||||
"owner": "sxyazi",
|
||||
"repo": "yazi",
|
||||
"rev": "7169e19ff01458b25dc6d0a0489bcac3b6c02904",
|
||||
"rev": "5e283402ceb2ddea03200020b60a10a099c09896",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
win-spice
|
||||
xwayland-satellite
|
||||
openrazer-daemon
|
||||
xdg-desktop-portal-termfilechooser
|
||||
];
|
||||
|
||||
# Bootloader.
|
||||
|
|
|
@ -28,11 +28,9 @@
|
|||
rpi-imager
|
||||
freecad
|
||||
flatpak
|
||||
gst_all_1.gstreamer
|
||||
prusa-slicer
|
||||
via
|
||||
vial
|
||||
scribus
|
||||
pdfarranger
|
||||
tdf
|
||||
pdfchain
|
||||
|
@ -44,6 +42,9 @@
|
|||
soundconverter
|
||||
wmctrl
|
||||
|
||||
scribus
|
||||
gimp3
|
||||
|
||||
# godot_4
|
||||
# gdtoolkit_4
|
||||
|
||||
|
@ -96,7 +97,6 @@
|
|||
krita-plugin-gmic
|
||||
rawtherapee
|
||||
inkscape
|
||||
gimp
|
||||
# kicad
|
||||
turbocase
|
||||
openscad-unstable
|
||||
|
|
6
modules/home/file-chooser/config
Normal file
6
modules/home/file-chooser/config
Normal file
|
@ -0,0 +1,6 @@
|
|||
### $XDG_CONFIG_HOME/xdg-desktop-portal-termfilechooser/config ###
|
||||
|
||||
[filechooser]
|
||||
cmd=yazi-wrapper.sh
|
||||
default_dir=$HOME
|
||||
env=TERMCMD= wezlauncher
|
40
modules/home/file-chooser/yazi-wrapper.sh
Executable file
40
modules/home/file-chooser/yazi-wrapper.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/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
|
||||
PATH="/usr/bin:/bin"
|
||||
|
||||
multiple="$1"
|
||||
directory="$2"
|
||||
save="$3"
|
||||
path="$4"
|
||||
out="$5"
|
||||
|
||||
cmd="yazi"
|
||||
termcmd="${TERMCMD:-wezlauncher ''}"
|
||||
|
||||
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"
|
|
@ -198,4 +198,6 @@
|
|||
|
||||
xdg.configFile."yazi/theme.toml".source = ./yazi/theme.toml;
|
||||
xdg.configFile."yazi/flavors".source = ./yazi/flavors;
|
||||
xdg.configFile."xdg-desktop-portal-termfilechooser/config".source = ./file-chooser/config;
|
||||
home.file.".local/bin/yazi-wrapper.sh".source = ./file-chooser/yazi-wrapper.sh;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue