network drivesmain
@ -0,0 +1,234 @@ | |||||
# -*- mode: conf-space -*- icon config file for [[https://github.com/gokcehan/lf/wiki/Icons][lf]] using mostly [[https://www.nerdfonts.com/cheat-sheet][nerdfonts]]. | |||||
## Basic File Types | |||||
tw | |||||
st | |||||
ow | |||||
dt | |||||
di | |||||
fi | |||||
ln | |||||
or | |||||
ex | |||||
## Misc | |||||
.config | |||||
webpack.config.* | |||||
## Full Matches | |||||
README | |||||
LICENSE | |||||
.DS_Store | |||||
.Dockerfile | |||||
CMakeLists.txt | |||||
.gitlab-ci.yml | |||||
## Extension Associations | |||||
*.git | |||||
*.edn | |||||
*.pdf | |||||
*.db | |||||
*.hs | |||||
*.vim | |||||
*.org | |||||
*.frm | |||||
*.myd | |||||
*.myi | |||||
*.mkd | |||||
*.ddf | |||||
*.sqlite | |||||
*.bib | |||||
*.part | |||||
*.torrent | |||||
*.url | |||||
*.link | |||||
*.ass | |||||
*.srt | |||||
*.nfo | |||||
*.psb | |||||
*.psd | |||||
*.xlsx | |||||
## Languages | |||||
*.c | |||||
*.cpp | |||||
*.cc | |||||
*.h | |||||
*.hh | |||||
*.hpp | |||||
*.css | |||||
*.scss | |||||
*.el | |||||
*.clj | |||||
*.py | |||||
*.rb | |||||
*.go | |||||
*.html | |||||
*.java | |||||
*.md | |||||
*.json | |||||
*.sc | |||||
*.scala | |||||
*.php | |||||
*.rs | |||||
*.js | |||||
*.ts | |||||
*.kts | |||||
*.gradle | |||||
*.rss 參 | |||||
## Shells and Command Interpreters | |||||
*.bash | |||||
*.cmd | |||||
*.fish | |||||
*.ps1 | |||||
*.sh | |||||
*.zsh | |||||
## Archives | |||||
*.7z | |||||
*.ace | |||||
*.alz | |||||
*.arc | |||||
*.arj | |||||
*.bz2 | |||||
*.bz | |||||
*.cab | |||||
*.cpio | |||||
*.deb | |||||
*.dwm | |||||
*.dz | |||||
*.ear | |||||
*.esd | |||||
*.gz | |||||
*.jar | |||||
*.lha | |||||
*.lrz | |||||
*.lz4 | |||||
*.lz | |||||
*.lzh | |||||
*.lzma | |||||
*.lzo | |||||
*.rar | |||||
*.rpm | |||||
*.rz | |||||
*.sar | |||||
*.swm | |||||
*.t7z | |||||
*.tar | |||||
*.taz | |||||
*.tbz2 | |||||
*.tbz | |||||
*.tgz | |||||
*.tlz | |||||
*.txz | |||||
*.tz | |||||
*.tzo | |||||
*.tzst | |||||
*.war | |||||
*.wim | |||||
*.xz | |||||
*.z | |||||
*.zip | |||||
*.zoo | |||||
*.zst | |||||
## Music | |||||
*.aac | |||||
*.mp3 | |||||
*.alac | |||||
*.flac | |||||
*.m4a | |||||
*.wav | |||||
*.webm | |||||
*.mka | |||||
*.mid | |||||
*.midi | |||||
## Video | |||||
*.avi | |||||
*.m2v | |||||
*.m4v | |||||
*.mkv | |||||
*.mov | |||||
*.mp4 | |||||
*.mp4v | |||||
## Image | |||||
*.asf | |||||
*.au | |||||
*.bmp | |||||
*.cgm | |||||
*.dl | |||||
*.emf | |||||
*.flc | |||||
*.fli | |||||
*.flv | |||||
*.gif | |||||
*.gl | |||||
*.jpeg | |||||
*.jpg | |||||
*.mjpeg | |||||
*.mjpg | |||||
*.mng | |||||
*.mpc | |||||
*.mpeg | |||||
*.mpg | |||||
*.nuv | |||||
*.oga | |||||
*.ogg | |||||
*.ogm | |||||
*.ogv | |||||
*.ogx | |||||
*.opus | |||||
*.pbm | |||||
*.pcx | |||||
*.pgm | |||||
*.png | |||||
*.ppm | |||||
*.qt | |||||
*.ra | |||||
*.rm | |||||
*.rmvb | |||||
*.spx | |||||
*.svg | |||||
*.svgz | |||||
*.tga | |||||
*.tif | |||||
*.tiff | |||||
*.vob | |||||
*.wmv | |||||
*.xbm | |||||
*.xcf | |||||
*.xpm | |||||
*.xspf | |||||
*.xwd | |||||
*.yuv | |||||
## Directories | |||||
.git/ | |||||
.github/ | |||||
.config/ | |||||
node_modules/ | |||||
games/ | |||||
steam/ | |||||
### Home Directories | |||||
# ~/downloads/ | |||||
~/media/videos/ ﳜ | |||||
~/media/images/ | |||||
~/media/music/ | |||||
~/.steam/ | |||||
~/.wine/ | |||||
~/.dotfiles/ | |||||
~/.mozilla/ | |||||
~/.tor-browser/ | |||||
### XDG Stuff | |||||
# ~/user/ | |||||
# ~/prog/ | |||||
# ~/multi/ | |||||
# ~/OS/ | |||||
# TODO | |||||
# |
@ -0,0 +1,106 @@ | |||||
# interpreter for shell commands | |||||
set shell sh | |||||
# set '-eu' options for shell commands | |||||
# These options are used to have safer shell commands. Option '-e' is used to | |||||
# exit on error and option '-u' is used to give error for unset variables. | |||||
# Option '-f' disables pathname expansion which can be useful when $f, $fs, and | |||||
# $fx variables contain names with '*' or '?' characters. However, this option | |||||
# is used selectively within individual commands as it can be limiting at | |||||
# times. | |||||
set shellopts '-eu' | |||||
# set internal field separator (IFS) to "\n" for shell commands | |||||
# This is useful to automatically split file names in $fs and $fx properly | |||||
# since default file separator used in these variables (i.e. 'filesep' option) | |||||
# is newline. You need to consider the values of these options and create your | |||||
# commands accordingly. | |||||
set ifs "\n" | |||||
# leave some space at the top and the bottom of the screen | |||||
set scrolloff 10 | |||||
# use enter for shell commands | |||||
map <enter> shell | |||||
# execute current file (must be executable) | |||||
map x $$f | |||||
map X !$f | |||||
# dedicated keys for file opener actions | |||||
map o &mimeopen $f | |||||
map O $mimeopen --ask $f | |||||
# define a custom 'open' command | |||||
# This command is called when current file is not a directory. You may want to | |||||
# use either file extensions and/or mime types here. Below uses an editor for | |||||
# text files and a file opener for the rest. | |||||
cmd open ${{ | |||||
case $(file --mime-type $f -b) in | |||||
text/*) $EDITOR $fx;; | |||||
*) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;; | |||||
esac | |||||
}} | |||||
# define a custom 'rename' command without prompt for overwrite | |||||
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 | |||||
# map r push :rename<space> | |||||
# make sure trash folder exists | |||||
# %mkdir -p ~/.trash | |||||
# move current file or selected files to trash folder | |||||
# (also see 'man mv' for backup/overwrite options) | |||||
cmd trash %set -f; mv $fx ~/.trash | |||||
# define a custom 'delete' command | |||||
# cmd delete ${{ | |||||
# set -f | |||||
# printf "$fx\n" | |||||
# printf "delete?[y/n]" | |||||
# read ans | |||||
# [ $ans = "y" ] && rm -rf $fx | |||||
# }} | |||||
# use '<delete>' key for either 'trash' or 'delete' command | |||||
# map <delete> trash | |||||
# map <delete> delete | |||||
# extract the current file with the right command | |||||
# (xkcd link: https://xkcd.com/1168/) | |||||
set icons | |||||
cmd extract ${{ | |||||
set -f | |||||
case $f in | |||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; | |||||
*.tar.gz|*.tgz) tar xzvf $f;; | |||||
*.tar.xz|*.txz) tar xJvf $f;; | |||||
*.zip) unzip $f;; | |||||
*.rar) unrar x $f;; | |||||
*.7z) 7z x $f;; | |||||
esac | |||||
}} | |||||
# compress current file or selected files with tar and gunzip | |||||
cmd tar ${{ | |||||
set -f | |||||
mkdir $1 | |||||
cp -r $fx $1 | |||||
tar czf $1.tar.gz $1 | |||||
rm -rf $1 | |||||
}} | |||||
# compress current file or selected files with zip | |||||
cmd zip ${{ | |||||
set -f | |||||
mkdir $1 | |||||
cp -r $fx $1 | |||||
zip -r $1.zip $1 | |||||
rm -rf $1 | |||||
}} | |||||
set previewer lf-ueberzug-previewer | |||||
set cleaner lf-ueberzug-cleaner |
@ -0,0 +1,17 @@ | |||||
#!/usr/bin/env sh | |||||
# TODO: Remove LF_UebERZUG_FIFO and use LF_UEBERZUG_TEMPDIR/fifo | |||||
cleanup() { | |||||
rm -r "$LF_UEBERZUG_TEMPDIR" 2>/dev/null | |||||
kill $ueberzugpid 2>/dev/null | |||||
} | |||||
export LF_UEBERZUG_TEMPDIR="$(mktemp -d -t lf-ueberzug-XXXXXX)" | |||||
trap cleanup INT | |||||
export LF_UEBERZUG_FIFO="$LF_UEBERZUG_TEMPDIR/fifo" | |||||
mkfifo "$LF_UEBERZUG_FIFO" | |||||
tail -f "$LF_UEBERZUG_FIFO" | ueberzug layer --silent & | |||||
ueberzugpid=$! | |||||
lf $@ | |||||
cleanup |
@ -0,0 +1,8 @@ | |||||
#!/usr/bin/env sh | |||||
cat <<EOF | paste -s -d '' > "$LF_UEBERZUG_FIFO" | |||||
{ | |||||
"action": "remove", | |||||
"identifier": "lf-preview" | |||||
} | |||||
EOF |
@ -0,0 +1,123 @@ | |||||
#!/usr/bin/env sh | |||||
preview() { | |||||
cat <<-EOF | paste -sd '' >"$LF_UEBERZUG_FIFO" | |||||
{ | |||||
"action": "add", "identifier": "lf-preview", | |||||
"path": "$1", "x": $4, "y": $5, "width": $2, "height": $3, | |||||
"scaler": "contain" | |||||
} | |||||
EOF | |||||
} | |||||
set -C -f -u | |||||
IFS=$'\n' | |||||
lf-ueberzug-cleaner # clean active preview | |||||
file="$1"; shift | |||||
# Settings | |||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB | |||||
HIGHLIGHT_TABWIDTH=8 | |||||
HIGHLIGHT_STYLE='base16/oceanicnext' | |||||
PYGMENTIZE_STYLE='autumn' | |||||
case "$(basename "$file" | tr '[A-Z]' '[a-z]')" in | |||||
# Archive | |||||
*.a|*.ace|*.alz|*.arc|*.arj|*.bz|*.bz2|*.cab|*.cpio|*.deb|*.gz|*.jar|*.lha|*.lz|*.lzh|*.lzma|*.lzo|\ | |||||
*.rpm|*.rz|*.t7z|*.tar|*.tbz|*.tbz2|*.tgz|*.tlz|*.txz|*.t*.Z|*.tzo|*.war|*.xpi|*.xz|*.Z|*.zip) | |||||
atool --list -- "$file" | |||||
bsdtar --list --file "$file" | |||||
exit 1;; | |||||
*.rar) | |||||
# Avoid password prompt by providing empty password | |||||
unrar lt -p- -- "$file" | |||||
exit 1;; | |||||
*.7z) | |||||
# Avoid password prompt by providing empty password | |||||
7z l -p -- "$file" | |||||
exit 1;; | |||||
# BitTorrent | |||||
*.torrent) | |||||
transmission-show -- "$file" | |||||
exit 1;; | |||||
# OpenDocument | |||||
*.odt|*.ods|*.odp|*.sxw) | |||||
# Preview as text conversion | |||||
odt2txt "$file" | |||||
exit 1;; | |||||
# HTML | |||||
*.htm|*.html|*.xhtml) | |||||
# Preview as text conversion | |||||
w3m -dump "$file" | |||||
lynx -dump -- "$file" | |||||
elinks -dump "$file" | |||||
exit 1;; # Continue with next handler on failure | |||||
*.avi|*.mp4|*.mkv) | |||||
thumbnail="$LF_UEBERZUG_TEMPDIR/thumbnail.png" | |||||
ffmpeg -y -i "$file" -vframes 1 "$thumbnail" | |||||
preview "$thumbnail" "$@" | |||||
exit 127;; | |||||
*.pdf) | |||||
thumbnail="$LF_UEBERZUG_TEMPDIR/thumbnail.png" | |||||
gs -o "$thumbnail" -sDEVICE=pngalpha -dLastPage=1 "$file" >/dev/null | |||||
preview "$thumbnail" "$@" | |||||
exit 127;; | |||||
*.jpg|*.jpeg|*.png|*.bmp) | |||||
preview "$file" "$@" | |||||
exit 127;; | |||||
*.svg) | |||||
thumbnail="$LF_UEBERZUG_TEMPDIR/thumbnail.png" | |||||
convert "$file" "$thumbnail" | |||||
preview "$thumbnail" "$@" | |||||
exit 127;; | |||||
esac | |||||
MIMETYPE="$( file --dereference --brief --mime-type -- "$file" )" | |||||
case "$MIMETYPE" in | |||||
# Text | |||||
text/plain) | |||||
cat "$file" | |||||
exit 127;; | |||||
text/* | */xml) | |||||
# Syntax highlight | |||||
if [ "$( stat --printf='%s' -- "$file" )" -gt "$HIGHLIGHT_SIZE_MAX" ]; then | |||||
notify-send 123 123123 | |||||
exit 2 | |||||
fi | |||||
if [ "$( tput colors )" -ge 256 ]; then | |||||
pygmentize_format='terminal256' | |||||
highlight_format='xterm256' | |||||
else | |||||
pygmentize_format='terminal' | |||||
highlight_format='ansi' | |||||
fi | |||||
highlight --replace-tabs="$HIGHLIGHT_TABWIDTH" --out-format="$highlight_format" --style="$HIGHLIGHT_STYLE" --force -- "$file" | |||||
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "$file" | |||||
exit 127;; | |||||
# Image | |||||
image/*) | |||||
# Preview as text conversion | |||||
# img2txt --gamma=0.6 -- "$file" && exit 1 | |||||
exiftool "$file" | |||||
exit 1;; | |||||
# Video and audio | |||||
video/* | audio/*|application/octet-stream) | |||||
mediainfo "$file" | |||||
exiftool "$file" | |||||
exit 1;; | |||||
esac | |||||
echo '----- File Type Classification -----' && file --dereference --brief -- "$file" | |||||
exit 1 | |||||