switching from ranger to lf
This commit is contained in:
parent
a33c7ad0d0
commit
ba7303e5b8
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
if [ -n "$FIFO_UEBERZUG" ]; then
|
||||
printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
|
||||
fi
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
# Basic vars
|
||||
set shellopts '-eu'
|
||||
set ifs "\n"
|
||||
set scrolloff 10
|
||||
set icons
|
||||
set period 1
|
||||
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
|
||||
set cleaner '~/.config/lf/cleaner'
|
||||
set previewer '~/.config/lf/scope'
|
||||
|
||||
# cmds/functions
|
||||
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;;
|
||||
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
|
||||
image/svg+xml) display -- $f ;;
|
||||
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
|
||||
setsid -f sxiv -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 ;;
|
||||
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/pgp-encrypted) $EDITOR $fx ;;
|
||||
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
|
||||
esac
|
||||
}}
|
||||
|
||||
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
|
||||
|
||||
cmd extract ${{
|
||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||
set -f
|
||||
printf "%s\n\t" "$fx"
|
||||
printf "extract?[y/N]"
|
||||
read ans
|
||||
[ $ans = "y" ] && aunpack $fx
|
||||
}}
|
||||
|
||||
cmd delete ${{
|
||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||
set -f
|
||||
printf "%s\n\t" "$fx"
|
||||
printf "delete?[y/N]"
|
||||
read ans
|
||||
[ $ans = "y" ] && rm -rf -- $fx
|
||||
}}
|
||||
|
||||
cmd moveto ${{
|
||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||
set -f
|
||||
clear; echo "Move to where?"
|
||||
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
|
||||
for x in $fx; do
|
||||
eval mv -iv \"$x\" \"$dest\"
|
||||
done &&
|
||||
notify-send "🚚 File(s) moved." "File(s) moved to $dest."
|
||||
}}
|
||||
|
||||
cmd copyto ${{
|
||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||
set -f
|
||||
clear; echo "Copy to where?"
|
||||
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" &&
|
||||
for x in $fx; do
|
||||
eval cp -ivr \"$x\" \"$dest\"
|
||||
done &&
|
||||
notify-send "📋 File(s) copied." "File(s) copies to $dest."
|
||||
}}
|
||||
|
||||
cmd setbg "$1"
|
||||
cmd bulkrename $vidir
|
||||
|
||||
# Bindings
|
||||
map <c-f> $lf -remote "send $id select \"$(fzf)\""
|
||||
map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
|
||||
map gh
|
||||
map g top
|
||||
map D delete
|
||||
map E extract
|
||||
map C copyto
|
||||
map M moveto
|
||||
map <c-n> push :mkdir<space>
|
||||
map <c-r> reload
|
||||
map <c-s> set hidden!
|
||||
map <enter> shell
|
||||
map x $$f
|
||||
map X !$f
|
||||
map o &mimeopen $f
|
||||
map O $mimeopen --ask $f
|
||||
|
||||
map A rename # at the very end
|
||||
map c push A<c-u> # new rename
|
||||
map I push A<c-a> # at the very beginning
|
||||
map i push A<a-b><a-b><a-f> # before extension
|
||||
map a push A<a-b> # after extension
|
||||
map B bulkrename
|
||||
map b $setbg $f
|
||||
|
||||
map <c-e> down
|
||||
map <c-y> up
|
||||
map V push :!nvim<space>
|
||||
|
||||
map W $setsid -f $TERMINAL >/dev/null 2>&1
|
||||
|
||||
map Y $printf "%s" "$fx" | xclip -selection clipboard
|
||||
|
||||
# Source Bookmarks
|
||||
#source "~/.config/lf/shortcutrc"
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
|
||||
# File preview handler for lf.
|
||||
|
||||
set -C -f
|
||||
IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
|
||||
|
||||
image() {
|
||||
if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then
|
||||
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
|
||||
else
|
||||
mediainfo "$6"
|
||||
fi
|
||||
}
|
||||
|
||||
ifub() {
|
||||
[ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Note that the cache file name is a function of file information, meaning if
|
||||
# an image appears in multiple places across the machine, it will not have to
|
||||
# be regenerated once seen.
|
||||
|
||||
case "$(file --dereference --brief --mime-type -- "$1")" in
|
||||
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
|
||||
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
|
||||
text/troff) man ./ "$1" | col -b ;;
|
||||
text/* | */xml | application/json) cat "$1" ;;
|
||||
application/zip) atool --list -- "$1" ;;
|
||||
audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;;
|
||||
video/* )
|
||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
||||
[ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0
|
||||
image "$CACHE" "$2" "$3" "$4" "$5" "$1"
|
||||
;;
|
||||
*/pdf)
|
||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
|
||||
[ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
|
||||
;;
|
||||
*opendocument*) odt2txt "$1" ;;
|
||||
application/pgp-encrypted) gpg -d -- "$1" ;;
|
||||
esac
|
||||
exit 1
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import os
|
||||
import ranger.api
|
||||
from ranger.core.linemode import LinemodeBase
|
||||
from .devicons import *
|
||||
|
||||
SEPARATOR = os.getenv('RANGER_DEVICONS_SEPARATOR', ' ')
|
||||
|
||||
@ranger.api.register_linemode
|
||||
class DevIconsLinemode(LinemodeBase):
|
||||
name = "devicons"
|
||||
|
||||
uses_metadata = False
|
||||
|
||||
def filetitle(self, file, metadata):
|
||||
return devicon(file) + SEPARATOR + file.relative_path
|
||||
|
|
@ -1,381 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# coding=UTF-8
|
||||
# These glyphs, and the mapping of file extensions to glyphs
|
||||
# has been copied from the vimscript code that is present in
|
||||
# https://github.com/ryanoasis/vim-devicons
|
||||
import re;
|
||||
import os;
|
||||
|
||||
# Get the XDG_USER_DIRS directory names from enviromental variables
|
||||
|
||||
xdgs_dirs = {path.split('/')[-2]: icon for key, icon in [
|
||||
('XDG_DOCUMENTS_DIR' , ''),
|
||||
('XDG_DOWNLOAD_DIR' , ''),
|
||||
('XDG_CONFIG_DIR' , ''),
|
||||
('XDG_MUSIC_DIR' , ''),
|
||||
('XDG_PICTURES_DIR' , ''),
|
||||
('XDG_PUBLICSHARE_DIR', ''),
|
||||
('XDG_TEMPLATES_DIR' , ''),
|
||||
('XDG_VIDEOS_DIR' , ''),
|
||||
] if (path := os.getenv(key))}
|
||||
|
||||
|
||||
# all those glyphs will show as weird squares if you don't have the correct patched font
|
||||
# My advice is to use NerdFonts which can be found here:
|
||||
# https://github.com/ryanoasis/nerd-fonts
|
||||
file_node_extensions = {
|
||||
'7z' : '',
|
||||
'a' : '',
|
||||
'ai' : '',
|
||||
'apk' : '',
|
||||
'asm' : '',
|
||||
'asp' : '',
|
||||
'aup' : '',
|
||||
'avi' : '',
|
||||
'awk' : '',
|
||||
'bash' : '',
|
||||
'bat' : '',
|
||||
'bmp' : '',
|
||||
'bz2' : '',
|
||||
'c' : '',
|
||||
'c++' : '',
|
||||
'cab' : '',
|
||||
'cbr' : '',
|
||||
'cbz' : '',
|
||||
'cc' : '',
|
||||
'class' : '',
|
||||
'clj' : '',
|
||||
'cljc' : '',
|
||||
'cljs' : '',
|
||||
'cmake' : '',
|
||||
'coffee' : '',
|
||||
'conf' : '',
|
||||
'cp' : '',
|
||||
'cpio' : '',
|
||||
'cpp' : '',
|
||||
'cs' : '',
|
||||
'csh' : '',
|
||||
'css' : '',
|
||||
'cue' : '',
|
||||
'cvs' : '',
|
||||
'cxx' : '',
|
||||
'd' : '',
|
||||
'dart' : '',
|
||||
'db' : '',
|
||||
'deb' : '',
|
||||
'diff' : '',
|
||||
'dll' : '',
|
||||
'doc' : '',
|
||||
'docx' : '',
|
||||
'dump' : '',
|
||||
'edn' : '',
|
||||
'eex' : '',
|
||||
'efi' : '',
|
||||
'ejs' : '',
|
||||
'elf' : '',
|
||||
'elm' : '',
|
||||
'epub' : '',
|
||||
'erl' : '',
|
||||
'ex' : '',
|
||||
'exe' : '',
|
||||
'exs' : '',
|
||||
'f#' : '',
|
||||
'fifo' : 'ﳣ',
|
||||
'fish' : '',
|
||||
'flac' : '',
|
||||
'flv' : '',
|
||||
'fs' : '',
|
||||
'fsi' : '',
|
||||
'fsscript' : '',
|
||||
'fsx' : '',
|
||||
'gem' : '',
|
||||
'gemspec' : '',
|
||||
'gif' : '',
|
||||
'go' : '',
|
||||
'gz' : '',
|
||||
'gzip' : '',
|
||||
'h' : '',
|
||||
'haml' : '',
|
||||
'hbs' : '',
|
||||
'hh' : '',
|
||||
'hpp' : '',
|
||||
'hrl' : '',
|
||||
'hs' : '',
|
||||
'htaccess' : '',
|
||||
'htm' : '',
|
||||
'html' : '',
|
||||
'htpasswd' : '',
|
||||
'hxx' : '',
|
||||
'ico' : '',
|
||||
'img' : '',
|
||||
'ini' : '',
|
||||
'iso' : '',
|
||||
'jar' : '',
|
||||
'java' : '',
|
||||
'jl' : '',
|
||||
'jpeg' : '',
|
||||
'jpg' : '',
|
||||
'js' : '',
|
||||
'json' : '',
|
||||
'jsx' : '',
|
||||
'key' : '',
|
||||
'ksh' : '',
|
||||
'leex' : '',
|
||||
'less' : '',
|
||||
'lha' : '',
|
||||
'lhs' : '',
|
||||
'log' : '',
|
||||
'lua' : '',
|
||||
'lzh' : '',
|
||||
'lzma' : '',
|
||||
'm4a' : '',
|
||||
'm4v' : '',
|
||||
'markdown' : '',
|
||||
'md' : '',
|
||||
'mdx' : '',
|
||||
'mjs' : '',
|
||||
'mkv' : '',
|
||||
'ml' : 'λ',
|
||||
'mli' : 'λ',
|
||||
'mov' : '',
|
||||
'mp3' : '',
|
||||
'mp4' : '',
|
||||
'mpeg' : '',
|
||||
'mpg' : '',
|
||||
'msi' : '',
|
||||
'mustache' : '',
|
||||
'nix' : '',
|
||||
'o' : '',
|
||||
'ogg' : '',
|
||||
'part' : '',
|
||||
'pdf' : '',
|
||||
'php' : '',
|
||||
'pl' : '',
|
||||
'pm' : '',
|
||||
'png' : '',
|
||||
'pp' : '',
|
||||
'ppt' : '',
|
||||
'pptx' : '',
|
||||
'ps1' : '',
|
||||
'psb' : '',
|
||||
'psd' : '',
|
||||
'pub' : '',
|
||||
'py' : '',
|
||||
'pyc' : '',
|
||||
'pyd' : '',
|
||||
'pyo' : '',
|
||||
'r' : 'ﳒ',
|
||||
'rake' : '',
|
||||
'rar' : '',
|
||||
'rb' : '',
|
||||
'rc' : '',
|
||||
'rlib' : '',
|
||||
'rmd' : '',
|
||||
'rom' : '',
|
||||
'rpm' : '',
|
||||
'rproj' : '鉶',
|
||||
'rs' : '',
|
||||
'rss' : '',
|
||||
'rtf' : '',
|
||||
's' : '',
|
||||
'sass' : '',
|
||||
'scala' : '',
|
||||
'scss' : '',
|
||||
'sh' : '',
|
||||
'slim' : '',
|
||||
'sln' : '',
|
||||
'so' : '',
|
||||
'sql' : '',
|
||||
'styl' : '',
|
||||
'suo' : '',
|
||||
'swift' : '',
|
||||
't' : '',
|
||||
'tar' : '',
|
||||
'tex' : 'ﭨ',
|
||||
'tgz' : '',
|
||||
'toml' : '',
|
||||
'torrent' : '',
|
||||
'ts' : '',
|
||||
'tsx' : '',
|
||||
'twig' : '',
|
||||
'vim' : '',
|
||||
'vimrc' : '',
|
||||
'vue' : '﵂',
|
||||
'wav' : '',
|
||||
'webm' : '',
|
||||
'webmanifest' : '',
|
||||
'webp' : '',
|
||||
'xbps' : '',
|
||||
'xcplayground' : '',
|
||||
'xhtml' : '',
|
||||
'xls' : '',
|
||||
'xlsx' : '',
|
||||
'xml' : '',
|
||||
'xul' : '',
|
||||
'xz' : '',
|
||||
'yaml' : '',
|
||||
'yml' : '',
|
||||
'zip' : '',
|
||||
'zsh' : '',
|
||||
}
|
||||
|
||||
dir_node_exact_matches = {
|
||||
# English
|
||||
'.git' : '',
|
||||
'Desktop' : '',
|
||||
'Documents' : '',
|
||||
'Downloads' : '',
|
||||
'Dotfiles' : '',
|
||||
'Dropbox' : '',
|
||||
'Music' : '',
|
||||
'Pictures' : '',
|
||||
'Public' : '',
|
||||
'Templates' : '',
|
||||
'Videos' : '',
|
||||
# Spanish
|
||||
'Escritorio' : '',
|
||||
'Documentos' : '',
|
||||
'Descargas' : '',
|
||||
'Música' : '',
|
||||
'Imágenes' : '',
|
||||
'Público' : '',
|
||||
'Plantillas' : '',
|
||||
'Vídeos' : '',
|
||||
# French
|
||||
'Bureau' : '',
|
||||
'Documents' : '',
|
||||
'Images' : '',
|
||||
'Musique' : '',
|
||||
'Publique' : '',
|
||||
'Téléchargements' : '',
|
||||
'Vidéos' : '',
|
||||
# Portuguese
|
||||
'Documentos' : '',
|
||||
'Imagens' : '',
|
||||
'Modelos' : '',
|
||||
'Música' : '',
|
||||
'Público' : '',
|
||||
'Vídeos' : '',
|
||||
'Área de trabalho' : '',
|
||||
# Italian
|
||||
'Documenti' : '',
|
||||
'Immagini' : '',
|
||||
'Modelli' : '',
|
||||
'Musica' : '',
|
||||
'Pubblici' : '',
|
||||
'Scaricati' : '',
|
||||
'Scrivania' : '',
|
||||
'Video' : '',
|
||||
# German
|
||||
'Bilder' : '',
|
||||
'Dokumente' : '',
|
||||
'Musik' : '',
|
||||
'Schreibtisch' : '',
|
||||
'Vorlagen' : '',
|
||||
'Öffentlich' : '',
|
||||
# Hungarian
|
||||
'Dokumentumok' : '',
|
||||
'Képek' : '',
|
||||
'Modelli' : '',
|
||||
'Zene' : '',
|
||||
'Letöltések' : '',
|
||||
'Számítógép' : '',
|
||||
'Videók' : '',
|
||||
# XDG_USER_DIRS
|
||||
**xdgs_dirs
|
||||
}
|
||||
|
||||
file_node_exact_matches = {
|
||||
'.bash_aliases' : '',
|
||||
'.bash_history' : '',
|
||||
'.bash_logout' : '',
|
||||
'.bash_profile' : '',
|
||||
'.bashprofile' : '',
|
||||
'.bashrc' : '',
|
||||
'.dmrc' : '',
|
||||
'.DS_Store' : '',
|
||||
'.fasd' : '',
|
||||
'.fehbg' : '',
|
||||
'.gitattributes' : '',
|
||||
'.gitconfig' : '',
|
||||
'.gitignore' : '',
|
||||
'.gitlab-ci.yml' : '',
|
||||
'.gvimrc' : '',
|
||||
'.inputrc' : '',
|
||||
'.jack-settings' : '',
|
||||
'.mime.types' : '',
|
||||
'.ncmpcpp' : '',
|
||||
'.nvidia-settings-rc' : '',
|
||||
'.pam_environment' : '',
|
||||
'.profile' : '',
|
||||
'.recently-used' : '',
|
||||
'.selected_editor' : '',
|
||||
'.vim' : '',
|
||||
'.viminfo' : '',
|
||||
'.vimrc' : '',
|
||||
'.Xauthority' : '',
|
||||
'.Xdefaults' : '',
|
||||
'.xinitrc' : '',
|
||||
'.xinputrc' : '',
|
||||
'.Xresources' : '',
|
||||
'.zshrc' : '',
|
||||
'_gvimrc' : '',
|
||||
'_vimrc' : '',
|
||||
'a.out' : '',
|
||||
'authorized_keys' : '',
|
||||
'bspwmrc' : '',
|
||||
'cmakelists.txt' : '',
|
||||
'config' : '',
|
||||
'config.ac' : '',
|
||||
'config.m4' : '',
|
||||
'config.mk' : '',
|
||||
'config.ru' : '',
|
||||
'configure' : '',
|
||||
'docker-compose.yml' : '',
|
||||
'dockerfile' : '',
|
||||
'Dockerfile' : '',
|
||||
'dropbox' : '',
|
||||
'exact-match-case-sensitive-1.txt' : 'X1',
|
||||
'exact-match-case-sensitive-2' : 'X2',
|
||||
'favicon.ico' : '',
|
||||
'gemfile' : '',
|
||||
'gruntfile.coffee' : '',
|
||||
'gruntfile.js' : '',
|
||||
'gruntfile.ls' : '',
|
||||
'gulpfile.coffee' : '',
|
||||
'gulpfile.js' : '',
|
||||
'gulpfile.ls' : '',
|
||||
'ini' : '',
|
||||
'known_hosts' : '',
|
||||
'ledger' : '',
|
||||
'license' : '',
|
||||
'LICENSE' : '',
|
||||
'LICENSE.md' : '',
|
||||
'LICENSE.txt' : '',
|
||||
'Makefile' : '',
|
||||
'makefile' : '',
|
||||
'Makefile.ac' : '',
|
||||
'Makefile.in' : '',
|
||||
'mimeapps.list' : '',
|
||||
'mix.lock' : '',
|
||||
'node_modules' : '',
|
||||
'package-lock.json' : '',
|
||||
'package.json' : '',
|
||||
'playlists' : '',
|
||||
'procfile' : '',
|
||||
'Rakefile' : '',
|
||||
'rakefile' : '',
|
||||
'react.jsx' : '',
|
||||
'README' : '',
|
||||
'README.markdown' : '',
|
||||
'README.md' : '',
|
||||
'README.rst' : '',
|
||||
'README.txt' : '',
|
||||
'sxhkdrc' : '',
|
||||
'user-dirs.dirs' : '',
|
||||
'webpack.config.js' : '',
|
||||
}
|
||||
|
||||
def devicon(file):
|
||||
if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
|
||||
return file_node_exact_matches.get(os.path.basename(file.relative_path), file_node_extensions.get(file.extension, ''))
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# How many columns are there, and what are their relative widths?
|
||||
set column_ratios 1,3,5
|
||||
|
||||
set show_hidden true
|
||||
set draw_borders both
|
||||
set preview_images true
|
||||
set preview_images_method ueberzug
|
||||
default_linemode devicons
|
||||
|
|
@ -12,7 +12,7 @@ alias \
|
|||
ytdlm='yt-dlp -f "(mp3)"' \
|
||||
cl='clear' \
|
||||
dots='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' \
|
||||
fm='ranger' \
|
||||
lf="lfub" \
|
||||
hst='history 1 -1 | cut -c 8- | sort | uniq | fzf | tr -d '\n' | xclip -sel c'
|
||||
|
||||
# Verbosity and settings that you pretty much just always are going to want.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,168 @@ export MPD_PORT="6600"
|
|||
# Mpd daemon start
|
||||
[ ! -s ~/.config/mpd/pid ] && mpd
|
||||
|
||||
export LF_ICONS="\
|
||||
di=:\
|
||||
fi=:\
|
||||
ln=:\
|
||||
or=:\
|
||||
ex=:\
|
||||
*.vimrc=:\
|
||||
*.viminfo=:\
|
||||
*.gitignore=:\
|
||||
*.c=:\
|
||||
*.cc=:\
|
||||
*.clj=:\
|
||||
*.coffee=:\
|
||||
*.cpp=:\
|
||||
*.css=:\
|
||||
*.d=:\
|
||||
*.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=:\
|
||||
*.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=:\
|
||||
*.nix=:\
|
||||
"
|
||||
|
||||
# Starting X
|
||||
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
|
||||
exec startx
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A dmenu prompt to unmount drives.
|
||||
# Provides you with mounted partitions, select one to unmount.
|
||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
unmountusb() {
|
||||
[ -z "$drives" ] && exit
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
[ -z "$chosen" ] && exit
|
||||
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
unmountandroid() { \
|
||||
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
|
||||
[ -z "$chosen" ] && exit
|
||||
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
asktype() { \
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
|
||||
case "$choice" in
|
||||
USB) unmountusb ;;
|
||||
Android) unmountandroid ;;
|
||||
esac
|
||||
}
|
||||
|
||||
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
|
||||
|
||||
if ! grep simple-mtpfs /etc/mtab; then
|
||||
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
||||
echo "Unmountable USB drive detected."
|
||||
unmountusb
|
||||
else
|
||||
if [ -z "$drives" ]
|
||||
then
|
||||
echo "Unmountable Android device detected."
|
||||
unmountandroid
|
||||
else
|
||||
echo "Unmountable USB drive(s) and Android device(s) detected."
|
||||
asktype
|
||||
fi
|
||||
fi
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This is a wrapper script for lb 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
|
||||
|
||||
cleanup() {
|
||||
exec 3>&-
|
||||
rm "$FIFO_UEBERZUG"
|
||||
}
|
||||
|
||||
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||
lf "$@"
|
||||
else
|
||||
[ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
|
||||
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
|
||||
mkfifo "$FIFO_UEBERZUG"
|
||||
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
|
||||
exec 3>"$FIFO_UEBERZUG"
|
||||
trap cleanup HUP INT QUIT TERM PWR EXIT
|
||||
lf "$@" 3>&-
|
||||
fi
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
# When I open an image from the file manager in sxiv (the image viewer), I want
|
||||
# to be able to press the next/previous keys to key through the rest of the
|
||||
# images in the same directory. This script "rotates" the content of a
|
||||
# directory based on the first chosen file, so that if I open the 15th image,
|
||||
# if I press next, it will go to the 16th etc. Autistic, I know, but this is
|
||||
# one of the reasons that sxiv is great for being able to read standard input.
|
||||
|
||||
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
||||
base="$(basename "$1")"
|
||||
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=File Manager
|
||||
Exec=/usr/local/bin/st -e fm %u
|
||||
Exec=/usr/local/bin/st -e lfub %u
|
||||
|
|
|
|||
Loading…
Reference in New Issue