Fix rangericons

This commit is contained in:
CramMK
2020-05-25 15:26:34 +02:00
parent 09adbc4265
commit 7bb307c514
7 changed files with 344 additions and 13 deletions

3
.gitmodules vendored
View File

@@ -4,6 +4,3 @@
[submodule "dotfiles/zsh/ohmyzsh"] [submodule "dotfiles/zsh/ohmyzsh"]
path = dotfiles/zsh/ohmyzsh path = dotfiles/zsh/ohmyzsh
url = https://github.com/ohmyzsh/ohmyzsh url = https://github.com/ohmyzsh/ohmyzsh
[submodule "dotfiles/ranger/plugins/ranger_devicons"]
path = dotfiles/ranger/plugins/ranger_devicons
url = https://github.com/alexanderjeurissen/ranger_devicons

View File

@@ -57,9 +57,6 @@ dotfiles:
d_tmux_themes: d_tmux_themes:
src: tmux/themes src: tmux/themes
dst: ~/.tmux/themes dst: ~/.tmux/themes
d_wallpaper:
src: wallpaper
dst: ~/.wallpaper
d_polybar: d_polybar:
src: polybar src: polybar
dst: ~/.config/polybar dst: ~/.config/polybar
@@ -92,7 +89,6 @@ profiles:
- font - font
- picom - picom
- tmux - tmux
- wallpaper
- polybar - polybar
- dunst - dunst
- rofi - rofi
@@ -109,7 +105,6 @@ profiles:
- font - font
- picom - picom
- tmux - tmux
- wallpaper
dev: dev:
include: include:
- vim - vim
@@ -146,9 +141,6 @@ profiles:
dotfiles: dotfiles:
- f_tmux - f_tmux
- d_tmux_themes - d_tmux_themes
wallpaper:
dotfiles:
- d_wallpaper
polybar: polybar:
dotfiles: dotfiles:
- d_polybar - d_polybar

View File

@@ -165,7 +165,7 @@ bindsym Ctrl+Shift+1 exec --no-startup-id setxkbmap za
# Background # Background
exec --no-startup-id picom exec --no-startup-id picom
exec --no-startup-id feh --bg-scale ~/.wallpaper/wallpaper.png exec --no-startup-id feh --bg-scale ~/wallpaper/wallpaper.png
# Remove title bar # Remove title bar
new_window 1pixel new_window 1pixel

View File

@@ -0,0 +1,323 @@
#!/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;
# 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' : '',
'bat' : '',
'bmp' : '',
'bz2' : '',
'c' : '',
'c++' : '',
'cab' : '',
'cbr' : '',
'cbz' : '',
'cc' : '',
'class' : '',
'clj' : '',
'cljc' : '',
'cljs' : '',
'cmake' : '',
'coffee' : '',
'conf' : '',
'cp' : '',
'cpio' : '',
'cpp' : '',
'cs' : '',
'css' : '',
'cue' : '',
'cvs' : '',
'cxx' : '',
'd' : '',
'dart' : '',
'db' : '',
'deb' : '',
'diff' : '',
'dll' : '',
'doc' : '',
'docx' : '',
'dump' : '',
'edn' : '',
'efi' : '',
'ejs' : '',
'elf' : '',
'elm' : '',
'epub' : '',
'erl' : '',
'ex' : '',
'exe' : '',
'exs' : '',
'eex' : '',
'f#' : '',
'fifo' : '|',
'fish' : '',
'flac' : '',
'flv' : '',
'fs' : '',
'fsi' : '',
'fsscript' : '',
'fsx' : '',
'gem' : '',
'gif' : '',
'go' : '',
'gz' : '',
'gzip' : '',
'h' : '',
'hbs' : '',
'hpp' : '',
'hrl' : '',
'hs' : '',
'htaccess' : '',
'htpasswd' : '',
'htm' : '',
'html' : '',
'ico' : '',
'img' : '',
'ini' : '',
'iso' : '',
'jar' : '',
'java' : '',
'jl' : '',
'jpeg' : '',
'jpg' : '',
'js' : '',
'json' : '',
'jsx' : '',
'key' : '',
'less' : '',
'lha' : '',
'lhs' : '',
'log' : '',
'lua' : '',
'lzh' : '',
'lzma' : '',
'm4a' : '',
'm4v' : '',
'markdown' : '',
'md' : '',
'mkv' : '',
'ml' : 'λ',
'mli' : 'λ',
'mov' : '',
'mp3' : '',
'mp4' : '',
'mpeg' : '',
'mpg' : '',
'msi' : '',
'mustache' : '',
'o' : '',
'ogg' : '',
'pdf' : '',
'php' : '',
'pl' : '',
'pm' : '',
'png' : '',
'pub' : '',
'ppt' : '',
'pptx' : '',
'psb' : '',
'psd' : '',
'py' : '',
'pyc' : '',
'pyd' : '',
'pyo' : '',
'rar' : '',
'rb' : '',
'rc' : '',
'rlib' : '',
'rom' : '',
'rpm' : '',
'rs' : '',
'rss' : '',
'rtf' : '',
's' : '',
'so' : '',
'scala' : '',
'scss' : '',
'sh' : '',
'slim' : '',
'sln' : '',
'sql' : '',
'styl' : '',
'suo' : '',
't' : '',
'tar' : '',
'tgz' : '',
'ts' : '',
'twig' : '',
'vim' : '',
'vimrc' : '',
'wav' : '',
'webm' : '',
'xbps' : '',
'xhtml' : '',
'xls' : '',
'xlsx' : '',
'xml' : '',
'xul' : '',
'xz' : '',
'yaml' : '',
'yml' : '',
'zip' : '',
}
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' : '',
}
file_node_exact_matches = {
'.Xauthority' : '',
'.Xdefaults' : '',
'.Xresources' : '',
'.bash_aliases' : '',
'.bashprofile' : '',
'.bash_profile' : '',
'.bash_logout' : '',
'.bash_history' : '',
'.bashrc' : '',
'.dmrc' : '',
'.DS_Store' : '',
'.fasd' : '',
'.fehbg' : '',
'.gitconfig' : '',
'.gitattributes' : '',
'.gitignore' : '',
'.inputrc' : '',
'.jack-settings' : '',
'.mime.types' : '',
'.nvidia-settings-rc' : '',
'.pam_environment' : '',
'.profile' : '',
'.recently-used' : '',
'.selected_editor' : '',
'.vim' : '',
'.vimrc' : '',
'.viminfo' : '',
'.xinitrc' : '',
'.xinputrc' : '',
'config' : '',
'Dockerfile' : '',
'docker-compose.yml' : '',
'dropbox' : '',
'exact-match-case-sensitive-1.txt' : 'X1',
'exact-match-case-sensitive-2' : 'X2',
'favicon.ico' : '',
'a.out' : '',
'bspwmrc' : '',
'sxhkdrc' : '',
'Makefile' : '',
'Makefile.in' : '',
'Makefile.ac' : '',
'config.mk' : '',
'config.m4' : '',
'config.ac' : '',
'configure' : '',
'Rakefile' : '',
'gruntfile.coffee' : '',
'gruntfile.js' : '',
'gruntfile.ls' : '',
'gulpfile.coffee' : '',
'gulpfile.js' : '',
'gulpfile.ls' : '',
'ini' : '',
'ledger' : '',
'package.json' : '',
'package-lock.json' : '',
'.ncmpcpp' : '',
'playlists' : '',
'known_hosts' : '',
'authorized_keys' : '',
'license' : '',
'LICENSE.md' : '',
'LICENSE' : '',
'LICENSE.txt' : '',
'mimeapps.list' : '',
'node_modules' : '',
'procfile' : '',
'react.jsx' : '',
'README.rst' : '',
'README.md' : '',
'README.markdown' : '',
'README' : '',
'README.txt' : '',
'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, ''))

View File

@@ -0,0 +1,19 @@
import ranger.api
from ranger.core.linemode import LinemodeBase
from .devicons import *
@ranger.api.register_linemode
class DevIconsLinemode(LinemodeBase):
name = "devicons"
uses_metadata = False
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
@ranger.api.register_linemode
class DevIconsLinemodeFile(LinemodeBase):
name = "filename"
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path

View File

@@ -1 +1,2 @@
set preview_images true set preview_images true
default_linemode devicons