all recent config changes
This commit is contained in:
200
apps/lf/colors
Normal file
200
apps/lf/colors
Normal file
@@ -0,0 +1,200 @@
|
||||
# Colors for filenames in lf
|
||||
|
||||
# file types (with matching order)
|
||||
ln 01;36 # LINK
|
||||
or 31;01 # ORPHAN
|
||||
tw 38;5;47 # STICKY_OTHER_WRITABLE
|
||||
ow 38;5;47 # OTHER_WRITABLE
|
||||
st 01;34 # STICKY
|
||||
di 01;34 # DIR
|
||||
pi 33 # FIFO
|
||||
so 01;35 # SOCK
|
||||
bd 33;01 # BLK
|
||||
cd 33;01 # CHR
|
||||
su 01;32 # SETUID
|
||||
sg 01;32 # SETGID
|
||||
ex 01;32 # EXEC
|
||||
fi 00 # FILE
|
||||
|
||||
# archives or compressed
|
||||
*.tar 01;31
|
||||
*.tgz 01;31
|
||||
*.arc 01;31
|
||||
*.arj 01;31
|
||||
*.taz 01;31
|
||||
*.lha 01;31
|
||||
*.lz4 01;31
|
||||
*.lzh 01;31
|
||||
*.lzma 01;31
|
||||
*.tlz 01;31
|
||||
*.txz 01;31
|
||||
*.tzo 01;31
|
||||
*.t7z 01;31
|
||||
*.zip 01;31
|
||||
*.xpi 01;31
|
||||
*.z 01;31
|
||||
*.dz 01;31
|
||||
*.gz 01;31
|
||||
*.lrz 01;31
|
||||
*.lz 01;31
|
||||
*.lzo 01;31
|
||||
*.xz 01;31
|
||||
*.zst 01;31
|
||||
*.tzst 01;31
|
||||
*.bz2 01;31
|
||||
*.bz 01;31
|
||||
*.tbz 01;31
|
||||
*.tbz2 01;31
|
||||
*.tz 01;31
|
||||
*.deb 01;31
|
||||
*.rpm 01;31
|
||||
*.jar 01;31
|
||||
*.war 01;31
|
||||
*.ear 01;31
|
||||
*.sar 01;31
|
||||
*.rar 01;31
|
||||
*.alz 01;31
|
||||
*.ace 01;31
|
||||
*.zoo 01;31
|
||||
*.cpio 01;31
|
||||
*.7z 01;31
|
||||
*.rz 01;31
|
||||
*.cab 01;31
|
||||
*.wim 01;31
|
||||
*.swm 01;31
|
||||
*.dwm 01;31
|
||||
*.esd 01;31
|
||||
|
||||
# image formats
|
||||
*.jpg 38;5;202
|
||||
*.JPG 38;5;202
|
||||
*.jpeg 38;5;202
|
||||
*.mjpg 38;5;202
|
||||
*.mjpeg 38;5;202
|
||||
*.jxl 38;5;202
|
||||
*.JXL 38;5;202
|
||||
*.webp 38;5;202
|
||||
*.gif 38;5;202
|
||||
*.bmp 38;5;202
|
||||
*.pbm 38;5;202
|
||||
*.pgm 38;5;202
|
||||
*.ppm 38;5;202
|
||||
*.tga 38;5;202
|
||||
*.xbm 38;5;202
|
||||
*.xpm 38;5;202
|
||||
*.tif 38;5;202
|
||||
*.tiff 38;5;202
|
||||
*.png 38;5;202
|
||||
*.svg 38;5;202
|
||||
*.svgz 38;5;202
|
||||
*.mng 38;5;202
|
||||
*.odg 38;5;202
|
||||
*.pcx 38;2;218;8;255
|
||||
*.mov 38;2;218;8;255
|
||||
*.mpg 38;2;218;8;255
|
||||
*.mpeg 38;2;218;8;255
|
||||
*.m2v 38;2;218;8;255
|
||||
*.mkv 38;2;218;8;255
|
||||
*.webm 38;2;218;8;255
|
||||
*.ogm 38;2;218;8;255
|
||||
*.mp4 38;2;218;8;255
|
||||
*.m4v 38;2;218;8;255
|
||||
*.mp4v 38;2;218;8;255
|
||||
*.vob 38;2;218;8;255
|
||||
*.qt 38;2;218;8;255
|
||||
*.nuv 38;2;218;8;255
|
||||
*.wmv 38;2;218;8;255
|
||||
*.asf 38;2;218;8;255
|
||||
*.rm 38;2;218;8;255
|
||||
*.rmvb 38;2;218;8;255
|
||||
*.flc 38;2;218;8;255
|
||||
*.avi 38;2;218;8;255
|
||||
*.fli 38;2;218;8;255
|
||||
*.flv 38;2;218;8;255
|
||||
*.gl 38;2;218;8;255
|
||||
*.dl 38;2;218;8;255
|
||||
*.xcf 38;2;218;8;255
|
||||
*.xwd 38;2;218;8;255
|
||||
*.yuv 38;2;218;8;255
|
||||
*.cgm 38;2;218;8;255
|
||||
*.emf 38;2;218;8;255
|
||||
*.ogv 38;2;218;8;255
|
||||
*.ogx 38;2;218;8;255
|
||||
|
||||
# audio formats
|
||||
*.aac 00;36
|
||||
*.au 00;36
|
||||
*.flac 00;36
|
||||
*.m4a 00;36
|
||||
*.mid 00;36
|
||||
*.midi 00;36
|
||||
*.mka 00;36
|
||||
*.mp3 00;36
|
||||
*.mpc 00;36
|
||||
*.ogg 00;36
|
||||
*.ra 00;36
|
||||
*.wav 00;36
|
||||
*.oga 00;36
|
||||
*.opus 00;36
|
||||
*.spx 00;36
|
||||
*.xspf 00;36
|
||||
|
||||
# other formats
|
||||
*.pdf 38;2;249;46;73
|
||||
*.PDF 38;2;249;46;73
|
||||
*.ps 38;2;249;46;73
|
||||
*.epub 38;2;249;46;73
|
||||
*.mobi 38;2;249;46;73
|
||||
*.ods 92
|
||||
*.xls 92
|
||||
*.XLS 92
|
||||
*.xlsx 92
|
||||
*.XLSX 92
|
||||
*.odt 94
|
||||
*.doc 94
|
||||
*.DOC 94
|
||||
*.docx 94
|
||||
*.DOCX 94
|
||||
*.odp 38;2;249;62;0
|
||||
*.ppt 38;2;249;62;0
|
||||
*.PPT 38;2;249;62;0
|
||||
*.pptx 38;2;249;62;0
|
||||
*.PPTX 38;2;249;62;0
|
||||
*.iso 38;5;221
|
||||
*.img 38;5;221
|
||||
*.py 38;5;220
|
||||
*.lua 38;5;39
|
||||
*.js 38;5;226
|
||||
*.htm 38;5;202
|
||||
*.html 38;5;202
|
||||
*.shtml 38;5;202
|
||||
*.xhtml 38;5;202
|
||||
*.css 38;5;39
|
||||
*.go 38;5;39
|
||||
*.php 38;5;75
|
||||
*.tex 38;5;36
|
||||
*.c 38;2;121;168;244
|
||||
*.cpp 38;2;141;116;244
|
||||
*.cs 38;2;203;121;244
|
||||
*.nim 38;5;220
|
||||
*.nims 38;5;220
|
||||
*.r 38;5;39
|
||||
*.R 38;5;39
|
||||
*.rs 38;2;225;105;0
|
||||
*.pl 38;2;0;115;255
|
||||
*.raku 38;2;225;0;221
|
||||
*.m 38;2;225;43;7
|
||||
*.java 38;2;225;136;0
|
||||
*.scala 38;5;196
|
||||
*.rb 38;5;196
|
||||
*.vim 32
|
||||
*.sql 38;5;249
|
||||
*.sqlite 38;5;249
|
||||
*.db 38;5;249
|
||||
*.odb 38;5;249
|
||||
*.apk 38;5;82
|
||||
*.apk 38;5;82
|
||||
*.jl 38;5;147
|
||||
*.hs 38;5;133
|
||||
*.lhs 38;5;133
|
||||
*.blend 38;5;208
|
||||
199
apps/lf/default.nix
Normal file
199
apps/lf/default.nix
Normal file
@@ -0,0 +1,199 @@
|
||||
{ pkgs, self, confDir, system, inputs, ... }@params:
|
||||
{
|
||||
home.file.".config/lf/icons".source = "${self}/programs/lf/icons";
|
||||
programs.lf = let
|
||||
|
||||
myUeberzug = pkgs.ueberzugpp.overrideAttrs (prev: {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jstkdng";
|
||||
repo = "ueberzugpp";
|
||||
rev = "528fb0fd6719477308e779aa6dab6040faa698cc";
|
||||
hash = "sha256-VdfpWJOMlC4Ly2lDFvJ+BnOmaM71gLEaIkfwLqzAi/8=";
|
||||
};
|
||||
cmakeFlags = prev.cmakeFlags or [] ++ [ "-DENABLE_SWAY=ON" ];
|
||||
});
|
||||
|
||||
oldpkgs = (builtins.getFlake "nixpkgs/release-25.05").legacyPackages.${system};
|
||||
mylf = oldpkgs.lf.overrideAttrs (final: prev: {
|
||||
patches = (prev.patches or [ ]) ++ [
|
||||
./lf-filter.patch
|
||||
];
|
||||
/*
|
||||
src = pkgs.fetchFromGitHub { # use the old v35 version of lf... so that my patch applies
|
||||
owner = "gokcehan";
|
||||
repo = "lf";
|
||||
rev = "r35";
|
||||
hash = "sha256-0ZyIbEKiQ9l30gqHlpW7l/6/TzqVRvnKk9c2FiQ6E6Y=";
|
||||
};
|
||||
*/
|
||||
checkPhase = "";
|
||||
});
|
||||
|
||||
myCleaner = pkgs.writeShellApplication {
|
||||
name = "myCleaner";
|
||||
|
||||
runtimeInputs = with pkgs; [ myUeberzug ];
|
||||
|
||||
text = ''
|
||||
ueberzugpp cmd -s "$UB_SOCKET" -a remove -i PREVIEW
|
||||
UB_PID=$(cat "$UB_PID_FILE")
|
||||
kill "$UB_PID"
|
||||
'';
|
||||
};
|
||||
|
||||
myPreviewer = pkgs.writeShellApplication {
|
||||
name = "myPreviewer";
|
||||
runtimeInputs = with pkgs; [
|
||||
file
|
||||
gnumeric
|
||||
catdoc
|
||||
odt2txt
|
||||
transmission_4
|
||||
libcdio
|
||||
p7zip
|
||||
unrar
|
||||
xz
|
||||
bat # (text)
|
||||
exiftool
|
||||
ffmpegthumbnailer
|
||||
myUeberzug # (images, videos, pdf, fonts)
|
||||
ffmpegthumbnailer # (videos)
|
||||
exiftool # (metadata/audio, and file detection for .webm files)
|
||||
jq # (json and metadata)
|
||||
lynx # (html/web pages)
|
||||
poppler-utils # pdftoppm # (pdf)
|
||||
odt2txt # (odt)
|
||||
imagemagick # convert from imagemagick (fonts)
|
||||
atool # (archives)
|
||||
gnupg # (PGP encrypted files)
|
||||
man # (troff manuals)
|
||||
coreutils #busybox # other
|
||||
];
|
||||
text = builtins.readFile "${self}/programs/lf/previewer";
|
||||
};
|
||||
|
||||
mylfWrapper = pkgs.writeShellApplication {
|
||||
name = "lf";
|
||||
|
||||
runtimeInputs = with pkgs; [ mylf myUeberzug util-linux ];
|
||||
|
||||
text = ''
|
||||
|
||||
# This is a wrapper script for lf that allows it to create image previews with
|
||||
# ueberzug. This works in concert with the lf configuration file and the
|
||||
# lf-cleaner script.
|
||||
|
||||
set -e
|
||||
set +o nounset
|
||||
|
||||
UB_PID=0
|
||||
UB_SOCKET=""
|
||||
|
||||
case "$(uname -a)" in
|
||||
*Darwin*) UEBERZUG_TMP_DIR="$TMPDIR" ;;
|
||||
*) UEBERZUG_TMP_DIR="/tmp" ;;
|
||||
esac
|
||||
|
||||
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||
${mylf}/bin/lf "$@"
|
||||
else
|
||||
[ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
|
||||
UB_PID_FILE="$UEBERZUG_TMP_DIR/.$(uuidgen)"
|
||||
ueberzugpp layer --silent --no-stdin --use-escape-codes --pid-file "$UB_PID_FILE"
|
||||
UB_PID=$(cat "$UB_PID_FILE")
|
||||
UB_SOCKET="$UEBERZUG_TMP_DIR/ueberzugpp-''${UB_PID}.socket"
|
||||
export UB_PID UB_SOCKET
|
||||
|
||||
${mylf}/bin/lf "$@"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
package = mylfWrapper // { inherit myUeberzug; };
|
||||
|
||||
enable = true;
|
||||
commands = {
|
||||
dragon-out = ''%${pkgs.dragon-drop}/bin/xdragon -a -x "$fx"'';
|
||||
editor-open = ''$$EDITOR $f'';
|
||||
mkdir = ''
|
||||
''${{
|
||||
printf "Directory Name: "
|
||||
read DIR
|
||||
mkdir $DIR
|
||||
}}
|
||||
'';
|
||||
nav = ''
|
||||
%{{${pkgs.python3}/bin/python3 ${confDir}/scripts/nav/main.py --mode lf}}
|
||||
'';
|
||||
nav-home = ''
|
||||
%{{
|
||||
${pkgs.python3}/bin/python3 ${confDir}/scripts/nav/main.py --mode lf --char H
|
||||
}}
|
||||
'';
|
||||
nav-work = ''
|
||||
%{{
|
||||
${pkgs.python3}/bin/python3 ${confDir}/scripts/nav/main.py --mode lf --char W
|
||||
}}
|
||||
'';
|
||||
};
|
||||
settings = {
|
||||
icons = true;
|
||||
drawbox = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
keybindings = {
|
||||
# sort by time
|
||||
mt = ":set sortby time; set info time; set reverse";
|
||||
# sort normally
|
||||
ms = ":set sortby natural; set info; set reverse!";
|
||||
F = "setfilter";
|
||||
P = "%pwd";
|
||||
W = "nav-work";
|
||||
H = "nav-home";
|
||||
n = "nav";
|
||||
"." = "set hidden!";
|
||||
"<enter>" = "open";
|
||||
do = "dragon-out";
|
||||
"gh" = "cd";
|
||||
"g/" = "/";
|
||||
ee = "editor-open";
|
||||
V = ''$${pkgs.bat}/bin/bat --paging=always --theme=gruvbox "$f"'';
|
||||
};
|
||||
extraConfig = ''
|
||||
%test $LF_LEVEL -eq 1 || >&2 printf "Warning: You're in a nested lf instance!"
|
||||
# export pid and ppid
|
||||
''${{
|
||||
myPID=$(ps -j | grep lf | tail -n 1 | awk '{print $1}')
|
||||
myPGID=$(ps -j | grep lf | tail -n 1 | awk '{print $2}')
|
||||
lf -remote "send $id set user_pid $myPID"
|
||||
lf -remote "send $id set user_pgid $myPGID"
|
||||
}}
|
||||
|
||||
source ${self}/programs/lf/opener
|
||||
set cleaner "${myCleaner}/bin/myCleaner"
|
||||
set cursorpreviewfmt "\033[7m"
|
||||
set previewer "${myPreviewer}/bin/myPreviewer"
|
||||
set period "1"
|
||||
|
||||
#set promptfmt "
|
||||
#\033[48;2;35;38;39;38;2;28;220;156m
|
||||
#\033[38;2;35;38;39;48;2;202;31;31m
|
||||
#\033[38;2;202;31;31;48;2;40;47;62m
|
||||
#\033[38;2;255;255;255m %w
|
||||
#\033[38;2;40;47;62;48;2;58;67;89m
|
||||
#\033[38;2;255;255;255m %f
|
||||
#\033[;38;2;58;67;89;49m\033[m"
|
||||
|
||||
set timefmt "2023-11-28 15:04:05 "
|
||||
set waitmsg "\033[1;31m⏎\033[m"
|
||||
set tabstop 4
|
||||
set shellopts "-eu"
|
||||
set ifs "\n"
|
||||
set shell "bash"
|
||||
#set ruler "df:acc:progress:selection:filter:ind"
|
||||
'';
|
||||
};
|
||||
}
|
||||
455
apps/lf/icons
Normal file
455
apps/lf/icons
Normal file
@@ -0,0 +1,455 @@
|
||||
# Icons for lf
|
||||
|
||||
# These icons require Nerd Fonts and emojis in a compatible font for terminals
|
||||
# See https://www.nerdfonts.com for more information.
|
||||
# Note: some double space emojis/icons render as 1-character width in some
|
||||
# terminals and as 2-character width in others. I'm adjusting them to make
|
||||
# them look aligned in the 'Alacritty' terminal
|
||||
|
||||
# file types (with matching order)
|
||||
ln 🔗 # LINK
|
||||
or ❌ # ORPHAN
|
||||
tw 🍃 # STICKY_OTHER_WRITABLE
|
||||
ow 📂 # OTHER_WRITABLE
|
||||
st 🔖 # STICKY
|
||||
di 📁 # DIR
|
||||
pi " " # FIFO
|
||||
so 🔌 # SOCK
|
||||
bd 🧱 # BLK
|
||||
cd " " # CHR
|
||||
su 🦸 # SETUID
|
||||
sg 👥 # SETGID
|
||||
ex 🎯 # EXEC
|
||||
fi 📄 # FILE
|
||||
|
||||
# file extensions (vim-devicons)
|
||||
*.styl " "
|
||||
*.sass " "
|
||||
*.scss " "
|
||||
*.htm " "
|
||||
*.html " "
|
||||
*.xhtml " "
|
||||
*.shtml " "
|
||||
*.slim " "
|
||||
*.haml " "
|
||||
*.ejs " "
|
||||
*.css " "
|
||||
*.qss " "
|
||||
*.rasi " "
|
||||
*.less " "
|
||||
*.wiki " "
|
||||
*.md " "
|
||||
*.mdx " "
|
||||
*.markdown " "
|
||||
*.rmd " "
|
||||
*.Rmd " "
|
||||
*.xml " "
|
||||
*.json " "
|
||||
*.bson " "
|
||||
*.webmanifest " "
|
||||
*.js " "
|
||||
*.mjs " "
|
||||
*.jsx " "
|
||||
*.rb " "
|
||||
*.gemspec " "
|
||||
*.rake " "
|
||||
*.php " "
|
||||
*.py " "
|
||||
*.pyc " "
|
||||
*.pyo " "
|
||||
*.pyd " "
|
||||
*.ipynb " "
|
||||
*.nim "👑"
|
||||
*.nims "👑"
|
||||
*.coffee " "
|
||||
*.mustache " "
|
||||
*.hbs " "
|
||||
*.conf "⚙ "
|
||||
*.ini "⚙ "
|
||||
*.yml "⚙ "
|
||||
*.yaml "⚙ "
|
||||
*.toml "⚙ "
|
||||
*.mk "⚙ "
|
||||
*.twig " "
|
||||
*.cpp " "
|
||||
*.c++ " "
|
||||
*.cxx " "
|
||||
*.cc " "
|
||||
*.cp " "
|
||||
*.c " "
|
||||
*.cs " "
|
||||
*.h " "
|
||||
*.hh " "
|
||||
*.hpp " "
|
||||
*.hxx " "
|
||||
*.hs " "
|
||||
*.lhs " "
|
||||
*.nix " "
|
||||
*.lua " "
|
||||
*.java " "
|
||||
*.sh " "
|
||||
*.fish " "
|
||||
*.bash " "
|
||||
*.zsh " "
|
||||
*.ksh " "
|
||||
*.csh " "
|
||||
*.awk " "
|
||||
*.sed " "
|
||||
*.m4 " "
|
||||
*.cmd " "
|
||||
*.bat " "
|
||||
*.ps1 " "
|
||||
*.ml " λ"
|
||||
*.mli " λ"
|
||||
*.diff " "
|
||||
*.db " "
|
||||
*.odb " "
|
||||
*.sql " "
|
||||
*.sqlite " "
|
||||
*.dump " "
|
||||
*.mongo " "
|
||||
*.rdb " "
|
||||
*.clj " "
|
||||
*.cljc " "
|
||||
*.cljs " "
|
||||
*.edn " "
|
||||
*.scala " "
|
||||
*.go " "
|
||||
*.dart " "
|
||||
*.xul " "
|
||||
*.sln " "
|
||||
*.suo " "
|
||||
*.pl " "
|
||||
*.pm " "
|
||||
*.t " "
|
||||
*.rss " "
|
||||
'*.f#' " "
|
||||
*.fsscript " "
|
||||
*.fsx " "
|
||||
*.fs " "
|
||||
*.fsi " "
|
||||
*.rs " "
|
||||
*.rlib " "
|
||||
*.d " "
|
||||
*.erl " "
|
||||
*.hrl " "
|
||||
*.ex " "
|
||||
*.exs " "
|
||||
*.eex " "
|
||||
*.leex " "
|
||||
*.heex " "
|
||||
*.vim " "
|
||||
*.ai " "
|
||||
*.psd " "
|
||||
*.psb " "
|
||||
*.ts " "
|
||||
*.tsx " "
|
||||
*.jl " "
|
||||
*.pp " "
|
||||
*.vue " ﵂"
|
||||
*.elm " "
|
||||
*.swift " "
|
||||
*.xcplayground " "
|
||||
*.tex " ﭨ"
|
||||
*.r " ﳒ"
|
||||
*.R " ﳒ"
|
||||
*.rproj "鉶"
|
||||
*.sol " ﲹ"
|
||||
*.apk " "
|
||||
*.xapk " "
|
||||
*.pem " "
|
||||
|
||||
# file names (vim-devicons) (case-insensitive not supported in lf)
|
||||
*gruntfile.coffee " "
|
||||
*gruntfile.js " "
|
||||
*gruntfile.ls " "
|
||||
*gulpfile.coffee " "
|
||||
*gulpfile.js " "
|
||||
*gulpfile.ls " "
|
||||
*mix.lock " "
|
||||
*dropbox " "
|
||||
*.ds_store "⚙ "
|
||||
*.git " "
|
||||
*.gitconfig " "
|
||||
*.gitignore " "
|
||||
*.gitattributes " "
|
||||
*.gitlab-ci.yml " "
|
||||
*bashrc "⚙ "
|
||||
*.zshrc "⚙ "
|
||||
*.zshenv "⚙ "
|
||||
*.zprofile "⚙ "
|
||||
*.vimrc " "
|
||||
*.gvimrc " "
|
||||
*_vimrc " "
|
||||
*_gvimrc " "
|
||||
*.bashprofile "⚙ "
|
||||
*favicon.ico " "
|
||||
*license "📜"
|
||||
*licence "📜"
|
||||
*node_modules " "
|
||||
*react.jsx " "
|
||||
*procfile " "
|
||||
*dockerfile " "
|
||||
*docker-compose.yml " "
|
||||
*rakefile " "
|
||||
*config.ru " "
|
||||
*gemfile " "
|
||||
*makefile "⚙ "
|
||||
*cmakelists.txt "⚙ "
|
||||
*robots.txt "🤖"
|
||||
|
||||
# file names (case-sensitive adaptations)
|
||||
*Gruntfile.coffee " "
|
||||
*Gruntfile.js " "
|
||||
*Gruntfile.ls " "
|
||||
*Gulpfile.coffee " "
|
||||
*Gulpfile.js " "
|
||||
*Gulpfile.ls " "
|
||||
*Dropbox " "
|
||||
*.DS_Store "⚙ "
|
||||
*LICENSE "📜"
|
||||
*LICENCE "📜"
|
||||
*COPYING "📜"
|
||||
*React.jsx " "
|
||||
*Procfile " "
|
||||
*Dockerfile " "
|
||||
*Docker-compose.yml " "
|
||||
*Rakefile " "
|
||||
*Gemfile " "
|
||||
*Makefile "⚙ "
|
||||
*CMakeLists.txt "⚙ "
|
||||
|
||||
# file patterns (vim-devicons) (patterns not supported in lf)
|
||||
# .*jquery.*\.js$ " "
|
||||
# .*angular.*\.js$ " "
|
||||
# .*backbone.*\.js$ " "
|
||||
# .*require.*\.js$ " "
|
||||
# .*materialize.*\.js$ " "
|
||||
# .*materialize.*\.css$ " "
|
||||
# .*mootools.*\.js$ " "
|
||||
# .*vimrc.* " "
|
||||
# Vagrantfile$ " "
|
||||
|
||||
# file patterns (file name adaptations)
|
||||
*jquery.min.js " "
|
||||
*angular.min.js " "
|
||||
*backbone.min.js " "
|
||||
*require.min.js " "
|
||||
*materialize.min.js " "
|
||||
*materialize.min.css " "
|
||||
*mootools.min.js " "
|
||||
*vimrc " "
|
||||
Vagrantfile " "
|
||||
|
||||
# archives or compressed extensions
|
||||
*.tar 📦
|
||||
*.tgz 📦
|
||||
*.arc 📦
|
||||
*.arj 📦
|
||||
*.taz 📦
|
||||
*.lha 📦
|
||||
*.lz4 📦
|
||||
*.lzh 📦
|
||||
*.lzma 📦
|
||||
*.tlz 📦
|
||||
*.txz 📦
|
||||
*.tzo 📦
|
||||
*.t7z 📦
|
||||
*.zip 📦
|
||||
*.z 📦
|
||||
*.dz 📦
|
||||
*.gz 📦
|
||||
*.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 📦
|
||||
*.xpi 📦
|
||||
|
||||
# image and video extensions
|
||||
*.jpg 📸
|
||||
*.JPG 📸
|
||||
*.jpeg 📸
|
||||
*.JPEG 📸
|
||||
*.jpe 📸
|
||||
*.mjpg 📸
|
||||
*.mjpeg 📸
|
||||
*.jxl "🖼 "
|
||||
*.JXL "🖼 "
|
||||
*.svg "🗺 "
|
||||
*.svgz "🗺 "
|
||||
*.bmp "🖼 "
|
||||
*.pbm "🖼 "
|
||||
*.pgm "🖼 "
|
||||
*.ppm "🖼 "
|
||||
*.tga "🖼 "
|
||||
*.xbm "🖼 "
|
||||
*.xpm "🖼 "
|
||||
*.tif "🖼 "
|
||||
*.tiff "🖼 "
|
||||
*.png "🖼 "
|
||||
*.PNG "🖼 "
|
||||
*.webp "🖼 "
|
||||
*.mng "🖼 "
|
||||
*.pcx "🖼 "
|
||||
*.ico "🖼 "
|
||||
*.gif "🎞 "
|
||||
*.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 🎥
|
||||
*.kdenlive 🎬
|
||||
*.prproj 🎬
|
||||
|
||||
# audio extensions
|
||||
*.wav 🎼
|
||||
*.aac 🎵
|
||||
*.au 🎵
|
||||
*.flac 🎵
|
||||
*.m4a 🎵
|
||||
*.mid 🎵
|
||||
*.midi 🎵
|
||||
*.mka 🎵
|
||||
*.mp3 🎵
|
||||
*.mpc 🎵
|
||||
*.ogg 🎵
|
||||
*.ra 🎵
|
||||
*.oga 🎵
|
||||
*.opus 🎵
|
||||
*.spx 🎵
|
||||
*.xspf 🎵
|
||||
|
||||
# other extensions
|
||||
*.elf " "
|
||||
*.exe " "
|
||||
*.appx " "
|
||||
*.msi " "
|
||||
*.app " "
|
||||
*.pdf " "
|
||||
*.PDF " "
|
||||
*.ps " "
|
||||
*.txt 📝
|
||||
*.TXT 📝
|
||||
*.csv 📓
|
||||
*.CSV 📓
|
||||
*.tsv 📓
|
||||
*.djvu 📚
|
||||
*.epub 📚
|
||||
*.torrent 📥
|
||||
*.magnet 🧲
|
||||
*.lrc 🎤
|
||||
*.kar 🎤
|
||||
*.src 💬
|
||||
*.gpg 🔐
|
||||
*.ssh 🔑
|
||||
*.key 🔑
|
||||
*.rsa 🔑
|
||||
*.pem 🔑
|
||||
*.sig 🪪
|
||||
*.asc "🕵 "
|
||||
*.manifest 📜
|
||||
*.log 📙
|
||||
*.xopp 📔
|
||||
*.iso 📀
|
||||
*.img 📀
|
||||
*.bib 🎓
|
||||
*.nfo " "
|
||||
*.info " "
|
||||
*.m 📊
|
||||
*.ods 📗
|
||||
*.xls 📗
|
||||
*.XLS 📗
|
||||
*.xlsx 📗
|
||||
*.XLSX 📗
|
||||
*.odt 📘
|
||||
*.doc 📘
|
||||
*.DOC 📘
|
||||
*.docx 📘
|
||||
*.DOCX 📘
|
||||
*.odp 📕
|
||||
*.ppt 📕
|
||||
*.PPT 📕
|
||||
*.pptx 📕
|
||||
*.PPTX 📕
|
||||
*.odg "🖼 "
|
||||
*.krita "🖌 "
|
||||
*.kra "🖌 "
|
||||
*.xcf "🖌 "
|
||||
*.eml 📧
|
||||
*.mom "✍ "
|
||||
*.me "✍ "
|
||||
*.ms "✍ "
|
||||
*.groff "✍ "
|
||||
*.tbl "✍ "
|
||||
*.pic "✍ "
|
||||
*.blend " "
|
||||
*.ffpreset " "
|
||||
*.bak "🗃 "
|
||||
*.desktop "🖥 "
|
||||
*.z64 🎮
|
||||
*.v64 🎮
|
||||
*.n64 🎮
|
||||
*.gba 🎮
|
||||
*.nes 🎮
|
||||
*.gdi 🎮
|
||||
*.gam 🎮
|
||||
*.sav 🎮
|
||||
*.scm 🎮
|
||||
*.bin 🎮
|
||||
*.psv 🎮
|
||||
*.rom 🎮
|
||||
*.xex 🎮
|
||||
*.jrz 🎮
|
||||
*.efi " "
|
||||
|
||||
# vim:ft=conf
|
||||
13
apps/lf/lf-filter.patch
Normal file
13
apps/lf/lf-filter.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/nav.go b/nav.go
|
||||
index c32fc97..95cc2ce 100644
|
||||
--- a/nav.go
|
||||
+++ b/nav.go
|
||||
@@ -1774,7 +1774,7 @@ func searchMatch(name, pattern string) (matched bool, err error) {
|
||||
if gOpts.globsearch {
|
||||
return filepath.Match(pattern, name)
|
||||
}
|
||||
- return strings.Contains(name, pattern), nil
|
||||
+ return strings.HasPrefix(name, pattern), nil
|
||||
}
|
||||
|
||||
func (nav *nav) searchNext() (bool, error) {
|
||||
242
apps/lf/opener
Normal file
242
apps/lf/opener
Normal file
@@ -0,0 +1,242 @@
|
||||
# Opener for lf
|
||||
|
||||
# En general, deberías delegar la apertura de ficheros a tu abridor de
|
||||
# recursos (e.g. xdg-open, mimeo), recomiendo ponerlo en la variable de
|
||||
# entorno $OPENER y luego configurar sus reglas de asociaciones entre tipos
|
||||
# MIME y lanzadores .desktop (e.g. ~/.config/applications/mimeapps.list)
|
||||
# Sin embargo, acá se puede programar comportamiento más avanzado basado
|
||||
# en más características de los ficheros y/o específicamente para lf
|
||||
# Tipos MIME IANA oficiales: https://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
|
||||
cmd open ${{
|
||||
|
||||
# Demonizador de comandos, en orden de preferencia
|
||||
dem() {
|
||||
{ setsid -f "$@" >/dev/null 2>&1& } \
|
||||
|| ({ nohup "$@" >/dev/null 2>&1& } &) \
|
||||
|| (exec "$@" >/dev/null 2>&1&)
|
||||
}
|
||||
|
||||
real_f="$(readlink -f $f || realpath $f)" \
|
||||
|
||||
mime_type="$(\
|
||||
exiftool -s3 -MIMEType "$real_f" 2>/dev/null \
|
||||
|| file --dereference -b --mime-type -- "$real_f" 2>/dev/null
|
||||
)"
|
||||
|
||||
case "$mime_type" in
|
||||
(application/pdf | application/postscript | image/vnd.djvu | application/epub*)
|
||||
dem "${READER:-zathura}" $fx
|
||||
;;
|
||||
(text/html)
|
||||
case "${f##*.}" in
|
||||
(xls) dem localc $f ;;
|
||||
(*) "${EDITOR:-nvim}" $fx
|
||||
esac
|
||||
;;
|
||||
(text/troff)
|
||||
case "${f##*.}" in
|
||||
([0-9] | [01]p | [23]*) man $fx ;;
|
||||
(*) "${EDITOR:-nvim}" $fx
|
||||
esac
|
||||
;;
|
||||
( text/* | application/json | application/javascript | \
|
||||
application/pgp-encrypted | inode/x-empty | application/octet-stream | \
|
||||
application/x-gettext-translation )
|
||||
"${EDITOR:-nvim}" $fx
|
||||
;;
|
||||
(image/x-*)
|
||||
dem "${IMAGE_EDITOR:-gimp}" $fx
|
||||
;;
|
||||
(image/* )
|
||||
case "$(tty)" in
|
||||
("/dev/tty"*) # En tty imágenes pueden ser mostradas con mpv
|
||||
"${MPV:-mpv}" --keep-open $fx
|
||||
;;
|
||||
(*) dem "${IMAGE_VIEWER:-vimiv}" $fx
|
||||
esac
|
||||
;;
|
||||
(audio/*)
|
||||
case "$(tty)" in
|
||||
("/dev/tty"*) # No demonizar en tty
|
||||
"${AUDIO_PLAYER:-"${MPV:-mpv}"}" --audio-display=no $fx
|
||||
;;
|
||||
(*) dem "${TERMINAL:-alacritty}" -e "${AUDIO_PLAYER:-"${MPV:-mpv}"}" --audio-display=no $fx
|
||||
esac
|
||||
;;
|
||||
(video/*)
|
||||
case "$(tty)" in
|
||||
("/dev/tty"*) # No demonizar en tty
|
||||
"${VIDEO_PLAYER:-"${MPV:-mpv}"}" $fx
|
||||
;;
|
||||
# TODO: handle video/webm like previewer
|
||||
(*) dem "${VIDEO_PLAYER:-"${MPV:-mpv}"}" $fx
|
||||
esac
|
||||
;;
|
||||
(application/vnd.sqlite3)
|
||||
sqlite3 $fx
|
||||
;;
|
||||
# text/xml)
|
||||
# ;;
|
||||
(application/zip)
|
||||
case "${f##*.}" in
|
||||
(kra) dem krita $f ;;
|
||||
(*)
|
||||
for f in $fx; do
|
||||
"${OPENER:-xdg-open}" $f
|
||||
done
|
||||
esac
|
||||
;;
|
||||
(*)
|
||||
case "$f" in
|
||||
# TODO: redo this with mime types, not extensions
|
||||
( *.tar.bz | *.tar.bz2 | *.tbz | \
|
||||
*.tbz2 | *.tar.gz | *.tgz | *.tar.lzma | \
|
||||
*.tar.xz | *.txz | *.zip | *.rar | *.iso)
|
||||
mntdir="$f-archivemount"
|
||||
if ! [ -d "$mntdir" ]; then
|
||||
mkdir -- "$mntdir"
|
||||
archivemount "$f" "$mntdir"
|
||||
printf -- "%s\n" "$mntdir" >> "/tmp/__lf_archivemount_$id"
|
||||
fi
|
||||
lf -remote "send $id cd '$mntdir'"
|
||||
lf -remote "send $id reload"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Delegate opening to resource opener
|
||||
|
||||
#pwhich() {
|
||||
# hash "$1" >/dev/null 2>&1 && command -v -- "$1"
|
||||
#}
|
||||
#[ "$OPENER" ] || OPENER=$(pwhich xdg-open)
|
||||
for f in $fx; do
|
||||
dem "${OPENER:-xdg-open}" $f
|
||||
#"${OPENER:-"${EDITOR:-nvim}"}" $f
|
||||
# ${OPENER:-"xdg-open"} $f || "${EDITOR:-"nvim"}" $f
|
||||
done
|
||||
;;
|
||||
esac
|
||||
}}
|
||||
|
||||
# Bug: In my AwesomeWM some JPGs or webm don't show the window until is tiled
|
||||
|
||||
cmd openwith ${{
|
||||
|
||||
dem() {
|
||||
{ setsid -f "$@" >/dev/null 2>&1& } \
|
||||
|| ({ nohup "$@" >/dev/null 2>&1& } &) \
|
||||
|| (exec "$@" >/dev/null 2>&1&)
|
||||
}
|
||||
|
||||
real_f="$(readlink -f $f || realpath $f)" \
|
||||
mime_type="$(\
|
||||
exiftool -s3 -MIMEType "$real_f" \
|
||||
|| file --dereference -b --mime-type -- "$real_f"
|
||||
)"
|
||||
|
||||
menu_select() {
|
||||
nl -nln | fzf --with-nth 2.. | cut -d' ' -f1
|
||||
}
|
||||
|
||||
# TODO: hacer que se puedan abrir con múltiples a la vez (fzf +m)
|
||||
case "$mime_type" in
|
||||
( text/* | application/json | application/javascript | \
|
||||
application/pgp-encrypted | inode/x-empty | application/octet-stream )
|
||||
app=$(menu_select <<-\EOF
|
||||
$EDITOR
|
||||
$EDITOR (new terminal)
|
||||
nano
|
||||
nano (new terminal)
|
||||
EOF
|
||||
)
|
||||
case "$app" in
|
||||
(1) "${EDITOR:-nvim}" $fx ;;
|
||||
(2) dem "${TERMINAL:-alacritty}" -e "$EDITOR" $fx ;;
|
||||
(3) nano $fx ;;
|
||||
(4) dem "${TERMINAL:-alacritty}" -e nano $fx ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(image/svg+xml | image/png | image/jpeg | image/gif )
|
||||
app=$(menu_select <<-\EOF
|
||||
vimiv
|
||||
gimp
|
||||
mpv
|
||||
krita
|
||||
inkscape
|
||||
EOF
|
||||
)
|
||||
case "$app" in
|
||||
(1) dem vimiv $fx ;;
|
||||
(2) dem gimp $fx ;;
|
||||
(3)
|
||||
case "$(tty)" in
|
||||
# Demonizing on tty makes it impossible to quit
|
||||
("/dev/tty"*) "${MPV:-mpv}" --keep-open=yes $fx ;;
|
||||
(*) dem "${MPV:-mpv}" --keep-open=yes $fx ;;
|
||||
esac
|
||||
;;
|
||||
(4) dem krita $fx ;;
|
||||
(5) dem inkscape $fx ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(image/x-*)
|
||||
app=$(menu_select <<-\EOF
|
||||
gimp
|
||||
vimiv
|
||||
mpv
|
||||
EOF
|
||||
)
|
||||
case "$app" in
|
||||
(1) dem gimp $fx ;;
|
||||
(2) dem vimiv $fx ;;
|
||||
(3)
|
||||
case "$(tty)" in
|
||||
# Demonizing on tty makes it impossible to quit
|
||||
("/dev/tty"*) "${MPV:-mpv}" --keep-open=yes $fx ;;
|
||||
(*) dem "${MPV:-mpv}" --keep-open=yes $fx ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(audio/*)
|
||||
app=$(menu_select <<-\EOF
|
||||
mpv (force terminal)
|
||||
mpv (background)
|
||||
mpv (background, only audio)
|
||||
mpv (foreground)
|
||||
mpv (foreground, only audio)
|
||||
mpv (force window)
|
||||
EOF
|
||||
)
|
||||
case "$app" in
|
||||
(1) dem "${TERMINAL:-alacritty}" -e "$MPV" --audio-display=no $fx ;;
|
||||
(2) dem "${MPV:-mpv}" $fx ;;
|
||||
(3) dem "${MPV:-mpv}" --audio-display=no $fx ;;
|
||||
(4) "${MPV:-mpv}" $fx ;;
|
||||
(5) echo; "${MPV:-mpv}" --audio-display=no $fx ;;
|
||||
(6) dem "${MPV:-mpv}" --force-window $fx ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(video/*)
|
||||
app=$(menu_select <<-\EOF
|
||||
mpv
|
||||
mpv (background, only audio)
|
||||
mpv (foreground, only audio)
|
||||
kdenlive
|
||||
EOF
|
||||
)
|
||||
case "$app" in
|
||||
(1) dem "${MPV:-mpv}" $fx ;;
|
||||
(2) dem "${MPV:-mpv}" --video=no --audio-display=no $fx ;;
|
||||
(3) echo; "${MPV:-mpv}" --video=no --audio-display=no $fx ;;
|
||||
(4) dem "${VIDEO_EDITOR:-kdenlive}" $fx ;;
|
||||
esac
|
||||
esac
|
||||
}}
|
||||
|
||||
# vim: ft=lf
|
||||
65
apps/lf/previewer
Executable file
65
apps/lf/previewer
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
image() {
|
||||
FILE_PATH="$1"
|
||||
X=$4
|
||||
Y=$5
|
||||
MW=$(($2 - 1))
|
||||
MH=$3
|
||||
ueberzug cmd -s "$UB_SOCKET" -a add -i PREVIEW -x "$X" -y "$Y" --max-width "$MW" --max-height "$MH" -f "$FILE_PATH"
|
||||
exit 1
|
||||
}
|
||||
|
||||
batorcat() {
|
||||
file="$1"
|
||||
shift
|
||||
if command -v bat >/dev/null 2>&1; then
|
||||
bat --color=always --style=plain --pager=never "$file" "$@"
|
||||
else
|
||||
cat "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
|
||||
|
||||
case "$(printf "%s\n" "$(readlink -f "$1")" | tr '[:upper:]' '[:lower:]')" in
|
||||
*.tgz | *.tar.gz) tar tzf "$1" ;;
|
||||
*.tar.bz2 | *.tbz2) tar tjf "$1" ;;
|
||||
*.tar.txz | *.txz) xz --list "$1" ;;
|
||||
*.tar) tar tf "$1" ;;
|
||||
*.zip | *.jar | *.war | *.ear | *.oxt) unzip -l "$1" ;;
|
||||
*.rar) unrar l "$1" ;;
|
||||
*.7z) 7z l "$1" ;;
|
||||
*.[1-8]) man "$1" | col -b ;;
|
||||
*.o) nm "$1" ;;
|
||||
*.torrent) transmission-show "$1" ;;
|
||||
*.iso) iso-info --no-header -l "$1" ;;
|
||||
*.odt | *.ods | *.odp | *.sxw) odt2txt "$1" ;;
|
||||
*.doc) catdoc "$1" ;;
|
||||
*.docx) docx2txt "$1" - ;;
|
||||
*.xls | *.xlsx)
|
||||
ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv
|
||||
;;
|
||||
*.wav | *.mp3 | *.flac | *.m4a | *.wma | *.ape | *.ac3 | *.og[agx] | *.spx | *.opus | *.as[fx] | *.mka)
|
||||
exiftool "$1"
|
||||
;;
|
||||
*.pdf)
|
||||
[ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
|
||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.avi | *.mp4 | *.wmv | *.dat | *.3gp | *.ogv | *.mkv | *.mpg | *.mpeg | *.vob | *.fl[icv] | *.m2v | *.mov | *.webm | *.ts | *.mts | *.m4v | *.r[am] | *.qt | *.divx)
|
||||
[ ! -f "${CACHE}.jpg" ] && ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5
|
||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.bmp | *.jpg | *.jpeg | *.png | *.xpm | *.webp | *.gif | *.jfif)
|
||||
image "$1" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*.svg)
|
||||
[ ! -f "${CACHE}.jpg" ] && convert "$1" "${CACHE}.jpg"
|
||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||
;;
|
||||
*)
|
||||
batorcat "$1"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
Reference in New Issue
Block a user