diff options
| author | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-02-23 15:03:10 -0500 |
|---|---|---|
| committer | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-02-23 15:03:10 -0500 |
| commit | 36a274dbc066068ff25b839e21ce3b82ec292c88 (patch) | |
| tree | 7e3de8bafab79cfa86c93f467413b8f43273a8a5 /lf | |
| parent | b29aab34dff6b76fd8eb067d51d2fe41be594616 (diff) | |
Diffstat (limited to 'lf')
| -rw-r--r-- | lf/dot-config/lf/lfrc | 12 | ||||
| -rwxr-xr-x | lf/dot-config/lf/scripts/previewer (renamed from lf/dot-config/lf/previewer) | 0 | ||||
| -rwxr-xr-x | lf/dot-config/lf/scripts/safe_extract | 25 | ||||
| -rw-r--r-- | lf/dot-config/lf/scripts/seccomp_default_filter.bpf | bin | 0 -> 504 bytes | |||
| -rw-r--r-- | lf/dot-config/lf/shortcutrc | 4 |
5 files changed, 31 insertions, 10 deletions
diff --git a/lf/dot-config/lf/lfrc b/lf/dot-config/lf/lfrc index ee30df9..137c3ce 100644 --- a/lf/dot-config/lf/lfrc +++ b/lf/dot-config/lf/lfrc @@ -8,17 +8,17 @@ set icons set scrolloff 10 set period 1 # set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" -set previewer "~/.config/lf/previewer" +set previewer "~/.config/lf/scripts/previewer" cmd open ${{ case $(file --mime-type "$(readlink -f "$f")" -b) in text/* | application/json | inode/x-empty | application/x-subrip) $EDITOR "$fx" ;; - image/*) setsid -f runapp -o -- imv -d $(rotdir "$f" | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$") 2>/dev/null | while read -r file; do + image/*) setsid -f imv -d $(rotdir "$f" | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$") 2>/dev/null | while read -r file; do [ -z "$file" ] && continue lf -remote "send select \"$file\"" done & ;; - audio/* | video/x-ms-asf) setsid -f runapp -o -- mpv --audio-display=no "$f" ;; - video/*) setsid -f runapp -o -- mpv "$f" -quiet >/dev/null 2>&1 ;; + audio/* | video/x-ms-asf) setsid -f mpv --audio-display=no "$f" ;; + video/*) setsid -f mpv "$f" -quiet >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR "$fx" ;; *) for f in $fx; do setsid -f xdg-open "$f" >/dev/null 2>&1; done ;; esac @@ -32,7 +32,7 @@ cmd extract ${{ while IFS= read -r filename; do filelist+=" $(basename "$filename")" done <<< "$fx" - if safe_extract "$fx"; then + if ~/.config/lf/scripts/safe_extract "$fx"; then lf -remote "send $id echomsg \"Extracted"$filelist" with ouch.\"" else lf -remote "send $id echoerr \"Cannot extract"$filelist" with ouch.\"" @@ -58,7 +58,7 @@ cmd fzf_jump ${{ }} cmd dragon ${{ - IFS="$(printf '\n\t')"; setsid -f runapp -o -- dragon-drop $fx + IFS="$(printf '\n\t')"; setsid -f dragon-drop $fx }} cmd git_branch ${{ diff --git a/lf/dot-config/lf/previewer b/lf/dot-config/lf/scripts/previewer index 1ce24f3..1ce24f3 100755 --- a/lf/dot-config/lf/previewer +++ b/lf/dot-config/lf/scripts/previewer diff --git a/lf/dot-config/lf/scripts/safe_extract b/lf/dot-config/lf/scripts/safe_extract new file mode 100755 index 0000000..619690a --- /dev/null +++ b/lf/dot-config/lf/scripts/safe_extract @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +( + exec bwrap \ + --ro-bind /usr/bin /usr/bin/ \ + --ro-bind /usr/share /usr/share \ + --ro-bind /usr/lib /usr/lib \ + --ro-bind /usr/lib64 /usr/lib64 \ + --symlink /usr/lib64 /lib64 \ + --symlink /usr/lib /lib \ + --symlink /usr/bin /bin \ + --symlink /usr/bin /sbin \ + --proc /proc \ + --dev /dev \ + --bind "$PWD" "$PWD" \ + --unshare-all \ + --new-session \ + --seccomp 10 \ + 10< "$SCRIPT_DIR"/seccomp_default_filter.bpf \ + /usr/bin/ouch decompress "$@" +) diff --git a/lf/dot-config/lf/scripts/seccomp_default_filter.bpf b/lf/dot-config/lf/scripts/seccomp_default_filter.bpf Binary files differnew file mode 100644 index 0000000..8b23eca --- /dev/null +++ b/lf/dot-config/lf/scripts/seccomp_default_filter.bpf diff --git a/lf/dot-config/lf/shortcutrc b/lf/dot-config/lf/shortcutrc deleted file mode 100644 index 09f9ae1..0000000 --- a/lf/dot-config/lf/shortcutrc +++ /dev/null @@ -1,4 +0,0 @@ -map Cmit cd "/home/moreka/mit/18.650-spring-26/" -map Clinatt cd "/home/moreka/mit/linear-attention/" -map Ecala $$EDITOR "/home/moreka/.config/alacritty/alacritty.toml" -map Ecnir $$EDITOR "/home/moreka/.config/niri/config.kdl" |
