lf: improve opener, change icons

This commit is contained in:
krolxon 2025-09-20 17:52:23 +05:30
parent 92e2da70f0
commit b13ae738e9
3 changed files with 643 additions and 168 deletions

View File

@ -1,4 +0,0 @@
#!/bin/sh
if [ -n "$FIFO_UEBERZUG" ]; then
printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
fi

View File

@ -2,159 +2,633 @@ di 
fi 
ln 
or 
ex 
ex
*kritadisplayrc 
*.gtkrc-2.0 
*bspwmrc 
*webpack 󰜫
*tsconfig.json 
*.vimrc 
*.viminfo 
*.gitignore 
*.c 
*.cc 
*.clj 
*.coffee 
*.cpp 
*.css 
*.d 
*gemfile$ 
*xmobarrc 
*avif 
*fp-info-cache 
*.zshrc 
*robots.txt 󰚩
*dockerfile 󰡨
*.git-blame-ignore-revs 
*.nvmrc 
*hyprpaper.conf 
*.prettierignore 
*rakefile 
*code_of_conduct 
*cmakelists.txt 
*.env 
*copying.lesser 
*readme 󰂺
*settings.gradle 
*gruntfile.coffee 
*.eslintignore 
*kalgebrarc 
*kdenliverc 
*.prettierrc.cjs 
*cantorrc 
*rmd 
*vagrantfile$ 
*.Xauthority 
*prettier.config.ts 
*node_modules 
*.prettierrc.toml 
*build.zig.zon 
*.ds_store 
*PKGBUILD 
*.prettierrc 
*.bash_profile 
*.npmignore 
*.mailmap 󰊢
*.codespellrc 󰓆
*svelte.config.js 
*eslint.config.ts 
*config 
*.gitlab-ci.yml 
*.gitconfig 
*_gvimrc 
*.xinitrc 
*checkhealth 󰓙
*sxhkdrc 
*.bashrc 
*tailwind.config.mjs 󱏿
*ext_typoscript_setup.txt 
*commitlint.config.ts 󰜘
*py.typed 
*.nanorc 
*commit_editmsg 
*.luaurc 
*fp-lib-table 
*.editorconfig 
*justfile 
*kdeglobals 
*license.md 
*.clang-format 
*docker-compose.yaml 󰡨
*copying 
*go.mod 
*lxqt.conf 
*brewfile 
*gulpfile.coffee 
*.dockerignore 󰡨
*.settings.json 
*tailwind.config.js 󱏿
*.clang-tidy 
*.gvimrc 
*nuxt.config.cjs 󱄆
*xsettingsd.conf 
*nuxt.config.js 󱄆
*eslint.config.cjs 
*sym-lib-table 
*.condarc 
*xmonad.hs 
*tmux.conf 
*xmobarrc.hs 
*.prettierrc.yaml 
*.pre-commit-config.yaml 󰛢
*i3blocks.conf 
*xorg.conf 
*.zshenv 
*vlcrc 󰕼
*license 
*unlicense 
*tmux.conf.local 
*.SRCINFO 󰣇
*tailwind.config.ts 󱏿
*security.md 󰒃
*security 󰒃
*.eslintrc 
*gradle.properties 
*code_of_conduct.md 
*PrusaSlicerGcodeViewer.ini 
*PrusaSlicer.ini 
*procfile 
*mpv.conf 
*.prettierrc.json5 
*i3status.conf 
*prettier.config.mjs 
*.pylintrc 
*prettier.config.cjs 
*.luacheckrc 
*containerfile 󰡨
*eslint.config.mjs 
*gruntfile.js 
*bun.lockb 
*.gitattributes 
*gruntfile.ts 
*pom.xml 
*favicon.ico 
*package-lock.json 
*build 
*package.json 
*nuxt.config.ts 󱄆
*nuxt.config.mjs 󱄆
*mix.lock 
*makefile 
*gulpfile.js 
*lxde-rc.xml 
*kritarc 
*gtkrc 
*ionic.config.json 
*.prettierrc.mjs 
*.prettierrc.yml 
*.npmrc 
*weston.ini 
*gulpfile.babel.js 
*i18n.config.ts 󰗊
*commitlint.config.js 󰜘
*.gitmodules 
*gradle-wrapper.properties 
*hypridle.conf 
*vercel.json ▲
*hyprlock.conf 
*go.sum 
*kdenlive-layoutsrc 
*gruntfile.babel.js 
*compose.yml 󰡨
*i18n.config.js 󰗊
*readme.md 󰂺
*gradlew 
*go.work 
*gulpfile.ts 
*gnumakefile 
*FreeCAD.conf 
*compose.yaml 󰡨
*eslint.config.js 
*hyprland.conf 
*docker-compose.yml 󰡨
*groovy 
*QtProject.conf 
*platformio.ini 
*build.gradle 
*.nuxtrc 󱄆
*_vimrc 
*.zprofile 
*.xsession 
*prettier.config.js 
*.babelrc 
*workspace 
*.prettierrc.json 
*.prettierrc.js 
*.Xresources 
*.gitignore 
*.justfile 
*.otf 
*.import 
*.krz 
*.adb 
*.ttf 
*.webpack 󰜫
*.dart 
*.erl 
*.exs 
*.fs 
*.go 
*.h 
*.hh 
*.hpp 
*.hs 
*.html 
*.java 
*.jl 
*.js 
*.json 
*.lua 
*.md 
*.php 
*.pl 
*.pro 
*.py 
*.rb 
*.rs 
*.scala 
*.ts 
*.vim 
*.cmd 
*.ps1 
*.sh 
*.bash 
*.zsh 
*.fish 
*.tar 
*.tgz 
*.arc 
*.arj 
*.taz 
*.lha 
*.lz4 
*.lzh 
*.lzma 
*.tlz 
*.txz 
*.tzo 
*.t7z 
*.zip 
*.z 
*.dz 
*.gz 
*.cz 
*.lrz 
*.lz 
*.lzo 
*.xz 
*.zst 
*.tzst 
*.bz2 
*.bz 
*.tbz 
*.tbz2 
*.tz 
*.deb 
*.rpm 
*.jar 
*.war 
*.ear 
*.sar 
*.rar 
*.alz 
*.ace 
*.zoo 
*.cpio 
*.7z 
*.rz 
*.cab 
*.wim 
*.swm 
*.dwm 
*.esd 
*.jpg 
*.jpeg 
*.mjpg 
*.mjpeg 
*.gif 
*.bmp 
*.pbm 
*.pgm 
*.ppm 
*.tga 
*.xbm 
*.xpm 
*.tif 
*.tiff 
*.png 
*.svg 
*.svgz 
*.mng 
*.pcx 
*.mov 
*.mpg 
*.mpeg 
*.m2v 
*.mkv 
*.webm 
*.ogm 
*.mp4 
*.m4v 
*.mp4v 
*.vob 
*.qt 
*.nuv 
*.wmv 
*.asf 
*.rm 
*.rmvb 
*.flc 
*.avi 
*.fli 
*.flv 
*.gl 
*.dl 
*.xcf 
*.xwd 
*.yuv 
*.cgm 
*.emf 
*.ogv 
*.ogx 
*.aac 
*.au 
*.flac 
*.m4a 
*.mid 
*.midi 
*.mka 
*.mp3 
*.mpc 
*.ogg 
*.ra 
*.wav 
*.oga 
*.opus 
*.spx 
*.xspf 
*.pdf 
*.vsh 
*.doc 󰈬
*.zsh 
*.ex 
*.hx 
*.fodt 
*.mojo 
*.templ 
*.nix 
*.cshtml 󱦗
*.fish 
*.ply 󰆧
*.sldprt 󰻫
*.gemspec 
*.mjs 
*.csh 
*.cmake 
*.fodp 
*.vi 
*.msf 
*.blp 󰺾
*.less 
*.sh 
*.odg 
*.mint 󰌪
*.dll 
*.odf 
*.sqlite3 
*.Dockerfile 󰡨
*.ksh 
*.rmd 
*.wv 
*.xml 󰗀
*.markdown 
*.qml 
*.3gp 
*.pxi 
*.flac 
*.gpr 
*.huff 󰡘
*.json 
*.gv 󱁉
*.bmp 
*.lock 
*.sha384 󰕥
*.cobol ⚙
*.cob ⚙
*.java 
*.cjs 
*.qm 
*.ebuild 
*.mustache 
*.terminal 
*.ejs 
*.brep 󰻫
*.rar 
*.gradle 
*.gnumakefile 
*.applescript 
*.elm 
*.ebook 
*.kra 
*.tf 
*.xls 󰈛
*.fnl 
*.kdbx 
*.kicad_pcb 
*.cfg 
*.ape 
*.org 
*.yml 
*.swift 
*.eln 
*.sol 
*.awk 
*.7z 
*.apl ⍝
*.epp 
*.app 
*.dot 󱁉
*.kpp 
*.eot 
*.hpp 
*.spec.tsx 
*.hurl 
*.cxxm 
*.c 
*.fcmacro 
*.sass 
*.yaml 
*.xz 
*.material 󰔉
*.json5 
*.signature λ
*.3mf 󰆧
*.jpg 
*.xpi 
*.fcmat 
*.pot 
*.bin 
*.xlsx 󰈛
*.aac 
*.kicad_sym 
*.xcstrings 
*.lff 
*.xcf 
*.azcli 
*.license 
*.jsonc 
*.xaml 󰙳
*.md5 󰕥
*.xm 
*.sln 
*.jl 
*.ml 
*.http 
*.x 
*.wvc 
*.wrz 󰆧
*.csproj 󰪮
*.wrl 󰆧
*.wma 
*.woff2 
*.woff 
*.tscn 
*.webmanifest 
*.webm 
*.fcbak 
*.log 󰌱
*.wav 
*.wasm 
*.styl 
*.gif 
*.resi 
*.aiff 
*.sha256 󰕥
*.igs 󰻫
*.vsix 
*.vim 
*.diff 
*.drl 
*.erl 
*.vhdl 󰍛
*.🔥 
*.hrl 
*.fsi 
*.mm 
*.bz 
*.vh 󰍛
*.kdb 
*.gz 
*.cpp 
*.ui 
*.txt 󰈙
*.spec.ts 
*.ccm 
*.typoscript 
*.typ 
*.txz 
*.test.ts 
*.tsx 
*.mk 
*.webp 
*.opus 
*.bicep 
*.ts 
*.tres 
*.torrent 
*.cxx 
*.iso 
*.ixx 
*.hxx 
*.gql 
*.tmux 
*.ini 
*.m3u8 󰲹
*.image 
*.tfvars 
*.tex 
*.cbl ⚙
*.flc 
*.elc 
*.test.tsx 
*.twig 
*.sql 
*.test.jsx 
*.htm 
*.gcode 󰐫
*.test.js 
*.ino 
*.tcl 󰛓
*.cljs 
*.tsconfig 
*.img 
*.t 
*.fcstd1 
*.out 
*.jsx 
*.bash 
*.edn 
*.rss 
*.flf 
*.cache 
*.sbt 
*.cppm 
*.svelte 
*.mo ∞
*.sv 󰍛
*.ko 
*.suo 
*.sldasm 󰻫
*.icalendar 
*.go 
*.sublime 
*.stl 󰆧
*.mobi 
*.graphql 
*.m3u 󰲹
*.cpy ⚙
*.kdenlive 
*.pyo 
*.po 
*.scala 
*.exs 
*.odp 
*.dump 
*.stp 󰻫
*.step 󰻫
*.ste 󰻫
*.aif 
*.strings 
*.cp 
*.fsscript 
*.mli 
*.bak 󰁯
*.ssa 󰨖
*.toml 
*.makefile 
*.php 
*.zst 
*.spec.jsx 
*.kbx 󰯄
*.fbx 󰆧
*.blend 󰂫
*.ifc 󰻫
*.spec.js 
*.so 
*.desktop 
*.sml λ
*.slvs 󰻫
*.pp 
*.ps1 󰨊
*.dropbox 
*.kicad_mod 
*.bat 
*.slim 
*.skp 󰻫
*.css 
*.xul 
*.ige 󰻫
*.glb 
*.ppt 󰈧
*.sha512 󰕥
*.ics 
*.mdx 
*.sha1 󰕥
*.f3d 󰻫
*.ass 󰨖
*.godot 
*.ifb 
*.cson 
*.lib 
*.luac 
*.heex 
*.scm 󰘧
*.psd1 󰨊
*.sc 
*.scad 
*.kts 
*.svh 󰍛
*.mts 
*.nfo 
*.pck 
*.rproj 󰗆
*.rlib 
*.cljd 
*.ods 
*.res 
*.apk 
*.haml 
*.d.ts 
*.razor 󱦘
*.rake 
*.patch 
*.cuh 
*.d 
*.query 
*.psb 
*.nu >
*.mov 
*.lrc 󰨖
*.pyx 
*.pyw 
*.cu 
*.bazel 
*.obj 󰆧
*.pyi 
*.pyd 
*.exe 
*.pyc 
*.fctb 
*.part 
*.blade.php 
*.git 
*.psd 
*.qss 
*.csv 
*.psm1 󰨊
*.dconf 
*.config.ru 
*.prisma 
*.conf 
*.clj 
*.o 
*.mp4 
*.cc 
*.kicad_prl 
*.bz3 
*.asc 󰦝
*.png 
*.android 
*.pm 
*.h 
*.pls 󰲹
*.ipynb 
*.pl 
*.ads 
*.sqlite 
*.pdf 
*.pcm 
*.ico 
*.a 
*.R 󰟔
*.ogg 
*.pxd 
*.kdenlivetitle 
*.jxl 
*.nswag 
*.nim 
*.bqn ⎉
*.cts 
*.fcparam 
*.rs 
*.mpp 
*.fdmdownload 
*.pptx 󰈧
*.jpeg 
*.bib 󱉟
*.vhd 󰍛
*.m 
*.js 
*.eex 
*.tbc 󰛓
*.astro 
*.sha224 󰕥
*.xcplayground 
*.el 
*.m4v 
*.m4a 
*.cs 󰌛
*.hs 
*.tgz 
*.fs 
*.luau 
*.dxf 󰻫
*.download 
*.cast 
*.qrc 
*.lua 
*.lhs 
*.md 
*.leex 
*.ai 
*.lck 
*.kt 
*.bicepparam 
*.hex 
*.zig 
*.bzl 
*.cljc 
*.kicad_dru 
*.fctl 
*.f# 
*.odt 
*.conda 
*.vala 
*.erb 
*.mp3 
*.bz2 
*.coffee 
*.cr 
*.f90 󱈚
*.jwmrc 
*.c++ 
*.fcscript 
*.fods 
*.cue 󰲹
*.srt 󰨖
*.info 
*.hh 
*.sig λ
*.html 
*.iges 󰻫
*.kicad_wks 
*.hbs 
*.fcstd 
*.gresource 
*.sub 󰨖
*.ical 
*.crdownload 
*.pub 󰷖
*.vue 
*.gd 
*.fsx 
*.mkv 
*.py 
*.kicad_sch 
*.epub 
*.env 
*.magnet 
*.elf 
*.fodg 
*.svg 󰜡
*.dwg 󰻫
*.docx 󰈬
*.pro 
*.db 
*.rb 
*.r 󰟔
*.scss 
*.cow 󰆚
*.gleam 
*.v 󰍛
*.kicad_pro 
*.liquid 
*.zip 

View File

@ -14,26 +14,31 @@ set autoquit true
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty) $EDITOR $fx;;
text/*|application/x-subrip) $EDITOR $fx;;
image/vnd.djvu|application/pdf|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;;
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jxl\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
setsid -f nsxiv -aio 2>/dev/null | while read -r file; do
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
done &
;;
audio/*) mpv --audio-display=no $f ;;
audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pgp-encrypted) $EDITOR $fx ;;
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
application/octet-stream) case ${f##*.} in
doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;;
ts) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
*) setsid -f zathura $fx >/dev/null 2>&1 ;;
esac ;;
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
esac
}}
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
cmd extract ${{