1
0
Fork 0
This commit is contained in:
Luca Bilke 2025-02-13 11:15:27 +01:00
commit 7474eafbcb
Signed by: luca
GPG key ID: F6E11C9BAA7C82F5
6 changed files with 89 additions and 73 deletions
common
.config
lf
nvim/lua
zsh/config
.local
bin
libexec/dwm

View file

@ -1,7 +1,6 @@
# Functions
cmd open ${{
set +u
files=${@:-$fx}
[ "$lf_user_multiedit" = "true" ] && {
$EDITOR $fx
lf -remote "send $id unselect"
@ -12,12 +11,11 @@ cmd open ${{
cmd pushedit %{{
set +u
files=$1
[ -z $files ] && {
echo "Open: " && read -r files
echo
}
echo $files | xargs -r touch
echo "Open: " && read -r files
echo
echo "$files" | xargs -r touch
lf -remote "send $id \$$OPENER $files"
}}
@ -83,20 +81,20 @@ cmd paste &{{
mode="$1"
shift
case "$mode" in
copy)
rsync -aP --del -- "$@" . &
i=0
while ps -p "$!" >/dev/null; do
i=$(((i + 1) % 3))
dots=""
for i in $(seq 0 $i); do
dots="${dots}."
copy)
rsync -aP --del -- "$@" . &
i=0
while ps -p "$!" >/dev/null; do
i=$(((i + 1) % 3))
dots=""
for i in $(seq 0 $i); do
dots="${dots}."
done
lf -remote "send $id echo 'Copying$dots'"
sleep 0.3
done
lf -remote "send $id echo 'Copying$dots'"
sleep 0.3
done
;;
move) mv -n -- "$@" . ;;
;;
move) mv -n -- "$@" . ;;
esac
rm ~/.local/share/lf/files
lf -remote "send clear"
@ -114,26 +112,27 @@ cmd fzf ${{
name="$1" input="$2" delimiter="$3" field="$4" path_field="$5" width="$6" query="${7:-}"
clear
file="$(eval "$input" | fzf \
--exact \
--query "$query" \
--delimiter "$delimiter" \
--nth="$field" \
--with-nth="$field" \
--preview-window="right,$width" \
--bind="focus:transform-preview-label(echo {} | cut -d '$delimiter' -f '$path_field')" \
--tiebreak="begin" \
--header="$name" \
--preview='
file=$(echo {} | cut -d '$delimiter' -f '$path_field')
if [ -f "$file" ] && [ -r "$file" ]; then
head -n $LINES "$file"
elif [ -d "$file" ] && [ -r "$file" ]; then
ls -pLHAN1 --color=always --group-directories-first "$file"
fi
' |
cut -d "$delimiter" -f "$path_field" |
tr -d '\n'
file="$(
eval "$input" | fzf \
--exact \
--query "$query" \
--delimiter "$delimiter" \
--nth="$field" \
--with-nth="$field" \
--preview-window="right,$width" \
--bind="focus:transform-preview-label(echo {} | cut -d '$delimiter' -f '$path_field')" \
--tiebreak="begin" \
--header="$name" \
--preview='
file=$(echo {} | cut -d '"$delimiter"' -f '"$path_field"')
if [ -f "$file" ] && [ -r "$file" ]; then
head -n $LINES "$file"
elif [ -d "$file" ] && [ -r "$file" ]; then
ls -pLHAN1 --color=always --group-directories-first "$file"
fi
' |
cut -d "$delimiter" -f "$path_field" |
tr -d '\n'
)"
[ -d "$file" ] && lf -remote "send $id cd '$file'"
[ -f "$file" ] && lf -remote "send $id select '$file'"

View file

@ -15,3 +15,4 @@ g.lazyvim_python_lsp = "basedpyright"
g.ai_cm = true
g.autoformat = false
g.snacks_animate = false
g.zk_notebook_dir = os.getenv("HOME") .. "/Public/notes"

View file

@ -24,6 +24,9 @@ return {
"zk-org/zk-nvim",
ft = { "markdown" },
main = "zk",
init = function()
vim.fn.setenv("ZK_NOTEBOOK_DIR", vim.g.zk_notebook_dir)
end,
opts = {
picker = "fzf_lua",
lsp = {

View file

@ -69,7 +69,7 @@ function lf-wrap() {
LF_DIRFILE="$(mktemp -u)"
env lfX -last-dir-path="$LF_DIRFILE" \
-command "set promptfmt \"$(${HOME}/.local/libexec/lf_prompt)\""
-command "set promptfmt \"$(${HOME}/.local/libexec/lf_prompt 2>/dev/null)\""
dir="$(cat "$LF_DIRFILE")"
rm "$LF_DIRFILE" &>/dev/null

View file

@ -46,4 +46,11 @@ if [[ "${XAUTHORITY:-}" == /tmp/* ]]; then
args+=(--ro-bind-try "$XAUTHORITY" "$XAUTHORITY")
fi
exec bwrap "${args[@]}" -- /usr/bin/steam -disable-cef-sandbox "$@"
if [ "${1:-}" == "--shell" ]; then
shift
[ -e "/bin/zsh" ] && sh="/bin/zsh"
[ -n "$*" ] && exec bwrap "${args[@]}" -- "$sh" -c "$*"
exec bwrap "${args[@]}" -- "$sh"
else
exec bwrap "${args[@]}" -- /usr/bin/steam -disable-cef-sandbox "$@"
fi

View file

@ -76,39 +76,45 @@ attemptmount() {
}
case "$chosen" in
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
parttype="$(echo "$lsblkoutput" | grep "$chosen"a)"
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
case "${parttype##* }" in
vfat) sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
btrfs) sudo -A mount "$chosen" "$mp" ;;
*) sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
esac
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
*)
notify-send "󱈸 Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
esac