diff options
| author | krolyxon <krolyxon@tutanota.com> | 2022-07-05 14:07:51 +0530 |
|---|---|---|
| committer | krolyxon <krolyxon@tutanota.com> | 2022-07-05 14:07:51 +0530 |
| commit | ba7303e5b852ecd96e6acf35d8fb1427c9be9c62 (patch) | |
| tree | 43e2e34080b3b2fdd02642e9e85d157273f6ffeb | |
| parent | a33c7ad0d05b218d8aa380031a68a90f25fbaca6 (diff) | |
switching from ranger to lf
| -rwxr-xr-x | .config/lf/cleaner | 4 | ||||
| -rw-r--r-- | .config/lf/lfrc | 114 | ||||
| -rwxr-xr-x | .config/lf/scope | 44 | ||||
| -rw-r--r-- | .config/ranger/plugins/__init__.py | 0 | ||||
| -rw-r--r-- | .config/ranger/plugins/ranger_devicons/__init__.py | 15 | ||||
| -rw-r--r-- | .config/ranger/plugins/ranger_devicons/devicons.py | 381 | ||||
| -rw-r--r-- | .config/ranger/rc.conf | 8 | ||||
| -rw-r--r-- | .config/shell/aliasrc | 2 | ||||
| -rw-r--r-- | .config/shell/profile | 162 | ||||
| -rwxr-xr-x | .local/bin/dmenuumount | 44 | ||||
| -rwxr-xr-x | .local/bin/lfub | 24 | ||||
| -rwxr-xr-x | .local/bin/rotdir | 12 | ||||
| -rw-r--r-- | .local/share/applications/file.desktop | 2 |
13 files changed, 406 insertions, 406 deletions
diff --git a/.config/lf/cleaner b/.config/lf/cleaner new file mode 100755 index 0000000..a184d84 --- /dev/null +++ b/.config/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +fi diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..4d9a134 --- /dev/null +++ b/.config/lf/lfrc @@ -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" diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100755 index 0000000..50ab4d5 --- /dev/null +++ b/.config/lf/scope @@ -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 diff --git a/.config/ranger/plugins/__init__.py b/.config/ranger/plugins/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/.config/ranger/plugins/__init__.py +++ /dev/null diff --git a/.config/ranger/plugins/ranger_devicons/__init__.py b/.config/ranger/plugins/ranger_devicons/__init__.py deleted file mode 100644 index 664b276..0000000 --- a/.config/ranger/plugins/ranger_devicons/__init__.py +++ /dev/null @@ -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 diff --git a/.config/ranger/plugins/ranger_devicons/devicons.py b/.config/ranger/plugins/ranger_devicons/devicons.py deleted file mode 100644 index ba67667..0000000 --- a/.config/ranger/plugins/ranger_devicons/devicons.py +++ /dev/null @@ -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, 'ξ')) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf deleted file mode 100644 index d65afff..0000000 --- a/.config/ranger/rc.conf +++ /dev/null @@ -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 diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index ad6afdb..30f6182 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -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. diff --git a/.config/shell/profile b/.config/shell/profile index c6fcf0c..f0172c9 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -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 diff --git a/.local/bin/dmenuumount b/.local/bin/dmenuumount new file mode 100755 index 0000000..946d12c --- /dev/null +++ b/.local/bin/dmenuumount @@ -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 diff --git a/.local/bin/lfub b/.local/bin/lfub new file mode 100755 index 0000000..9012f50 --- /dev/null +++ b/.local/bin/lfub @@ -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 diff --git a/.local/bin/rotdir b/.local/bin/rotdir new file mode 100755 index 0000000..86da6db --- /dev/null +++ b/.local/bin/rotdir @@ -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; }' diff --git a/.local/share/applications/file.desktop b/.local/share/applications/file.desktop index a8e458b..5df1633 100644 --- a/.local/share/applications/file.desktop +++ b/.local/share/applications/file.desktop @@ -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 |
