Added all current configs that I see are important

This commit is contained in:
ManOfGoldForever 2025-11-12 16:35:56 -05:00
parent 7e2ddc1054
commit d9bed25ebc
48 changed files with 4854 additions and 35 deletions

View file

@ -0,0 +1,11 @@
[filechooser]
cmd=yazi-wrapper.sh
default_dir=$HOME
; Uncomment to skip creating destination save files with instructions in them
; create_help_file=0
; Uncomment and edit the line below to change the terminal emulator command
env=TERMCMD=kitty -e
; Mode must be one of 'suggested', 'default', or 'last'.
open_mode=suggested
save_mode=suggested

View file

@ -0,0 +1,43 @@
#!/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 -e
if [ "$6" -ge 4 ]; then
set -x
fi
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="lf"
termcmd="${TERMCMD:-kitty --title 'termfilechooser'}"
if [ "$save" = "1" ]; then
# save a file
set -- -selection-path "$out" "$path"
elif [ "$directory" = "1" ]; then
# upload files from a directory
set -- -last-dir-path "$out" "$path"
elif [ "$multiple" = "1" ]; then
# upload multiple files
set -- -selection-path "$out" "$path"
else
# upload only 1 file
set -- -selection-path "$out" "$path"
fi
command="$termcmd $cmd"
for arg in "$@"; do
# escape double quotes
escaped=$(printf "%s" "$arg" | sed 's/"/\\"/g')
# escape special
command="$command \"$escaped\""
done
sh -c "$command"

View file

@ -0,0 +1,54 @@
#!/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 -e
if [ "$6" -ge 4 ]; then
set -x
fi
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="nnn"
termcmd="${TERMCMD:-kitty --title 'termfilechooser'}"
if [ "$save" = "1" ]; then
# save a file
set -- -p "$out" "$path"
elif [ "$directory" = "1" ]; then
# upload files from a directory
set -- -p "$out" "$path"
elif [ "$multiple" = "1" ]; then
# upload multiple files
set -- -p "$out" "$path"
else
# upload only 1 file
set -- -p "$out" "$path"
fi
command="$termcmd $cmd"
for arg in "$@"; do
# escape double quotes
escaped=$(printf "%s" "$arg" | sed 's/"/\\"/g')
# escape special
command="$command \"$escaped\""
done
if [ "$directory" = "1" ]; then
sh -c "env NNN_TMPFILE=\"$out\" $command"
else
sh -c "$command"
fi
if [ "$directory" = "1" ] && [ -s "$out" ]; then
# select on quit; file data will be `cd '/dir/path'`
if [ "$(cut -c -2 "$out")" = "cd" ]; then
sed -i "s/^cd '\(.*\)'/\1/" "$out"
fi
fi

View file

@ -0,0 +1,43 @@
#!/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 -e
if [ "$6" -ge 4 ]; then
set -x
fi
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="ranger"
termcmd="${TERMCMD:-kitty --title 'termfilechooser'}"
if [ "$save" = "1" ]; then
# save a file
set -- --choosefile="$out" --cmd="echo Select save path (see tutorial in preview pane; try pressing zv or zp if no preview)" --selectfile="$path"
elif [ "$directory" = "1" ]; then
# upload files from a directory
set -- --choosedir="$out" --show-only-dirs --cmd="echo Select directory (quit in dir to select it)" "$path"
elif [ "$multiple" = "1" ]; then
# upload multiple files
set -- --choosefiles="$out" --cmd="echo Select file(s) (open file to select it; <Space> to select multiple)" "$path"
else
# upload only 1 file
set -- --choosefile="$out" --cmd="echo Select file (open file to select it)" "$path"
fi
command="$termcmd $cmd"
for arg in "$@"; do
# escape double quotes
escaped=$(printf "%s" "$arg" | sed 's/"/\\"/g')
# escape special
command="$command \"$escaped\""
done
sh -c "$command"

View file

@ -0,0 +1,11 @@
[Unit]
Description=Portal service (terminal file chooser implementation)
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Type=dbus
BusName=org.freedesktop.impl.portal.desktop.termfilechooser
ExecStart=@libexecdir@/xdg-desktop-portal-termfilechooser
Restart=on-failure
Slice=session.slice

View file

@ -0,0 +1,45 @@
#!/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 -e
if [ "$6" -ge 4 ]; then
set -x
fi
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="vifm"
termcmd="${TERMCMD:-kitty --title 'termfilechooser'}"
if [ "$save" = "1" ]; then
# save a file
set -- --choose-files "$out" -c "only" -c "map <esc> :cquit<cr>" \
-c "set statusline='Save file (press <Enter> to select or <Esc> to cancel)%NCursorfile is the recommended choice, you can rename/move it%NIf you select another file, it will be overwritten by the save'" \
--select "$path" >"$path"
elif [ "$directory" = "1" ]; then
# upload files from a directory
set -- --choose-files "$out" --choose-dir "$out" -c "only" -c "map <esc> :cquit<cr>" -c "set statusline='Select directory (:quit in dir or select and open it, press <Esc> to cancel)'"
elif [ "$multiple" = "1" ]; then
# upload multiple files
set -- --choose-files "$out" -c "only" -c "map <esc> :cquit<cr>" -c "set statusline='Select file(s) (press <t> key to select multiple, press <Esc> to cancel)'"
else
# upload only 1 file
set -- --choose-files "$out" -c "only" -c "map <esc> :cquit<cr>" -c "set statusline='Select file (open file to select it, press <Esc> to cancel)'"
fi
command="$termcmd $cmd"
for arg in "$@"; do
# escape double quotes
escaped=$(printf "%s" "$arg" | sed 's/"/\\"/g')
# escape special
command="$command \"$escaped\""
done
sh -c "$command"

View file

@ -0,0 +1,52 @@
#!/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 -e
if [ "$6" -ge 4 ]; then
set -x
fi
multiple="$1"
directory="$2"
save="$3"
path="$4"
out="$5"
cmd="yazi"
termcmd="${TERMCMD:-kitty --title 'termfilechooser'}"
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"".1" "$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 special
command="$command \"$escaped\""
done
sh -c "$command"
if [ "$directory" = "1" ]; then
if [ ! -s "$out" ] && [ -s "$out"".1" ]; then
cat "$out"".1" > "$out"
rm "$out"".1"
else
rm "$out"".1"
fi
fi