Updated i3, fonts and ranger configurations

This commit is contained in:
lanxu 2020-06-03 16:51:25 +03:00
parent afa6ce6902
commit 4160f106b3
13 changed files with 323 additions and 144 deletions

View File

@ -29,7 +29,10 @@
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>verdana</string></test>
<edit name="family" mode="assign" binding="same"><string>Ubuntu</string></edit>
</match>
<!-- Prefer Liberation -->
<alias>
<family>sans-serif</family>

View File

@ -48,12 +48,17 @@ exec --no-startup-id "udiskie --notify --automount" # Automounter
# Background software
exec --no-startup-id "blueman-manager" # Bluetooth
exec --no-startup-id "cantata"
exec --no-startup-id "boincmgr"
exec --no-startup-id "nextcloud"
exec --no-startup-id "pavucontrol"
exec --no-startup-id "keepassxc" # Password manager
# Applications
exec --no-startup-id "telegram-desktop"
# Set manual layout for tray workspace
exec --no-startup-id "i3-msg 'workspace 10:tray; append_layout /home/lanxu/.config/i3/tray.json'"
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
@ -158,7 +163,7 @@ set $ws5 "5:steam"
set $ws6 "6:lutris"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws9 "9:pw"
set $ws10 "10:tray"
# switch to workspace
@ -235,8 +240,9 @@ for_window [class="Arandr"] floating enable
for_window [title="^Telegram$"] floating enable, move scratchpad
for_window [class="itch"] floating enable
# for_window [class="Wine"] floating enable
for_window [class="mpv"] floating enabler, move position center
for_window [class="mpv"] floating enable, move position center
for_window [class="vlc"] floating enable
for_window [class="Mumble"] floating enable, move position center
for_window [class="Sxiv"] floating enable
for_window [class="Lutris"] move container to workspace $ws6
for_window [class="Gimp"] move container to workspace $ws4
@ -249,6 +255,12 @@ for_window [class="Nextcloud"] floating disable, move container to workspace $ws
for_window [class="Blueman-manager"] move container to workspace $ws10
for_window [class="Pavucontrol"] move container to workspace $ws10e
for_window [class="cantata"] floating disable, move container to workspace $ws10
for_window [class="boincmgr"] floating disable, move container to workspace $ws10
for_window [class="KeePassXC"] move container to workspace $ws9
# Games
for_window [class="kfgame.exe"] floating enable
for_window [class="Wine"] floating enable
# Steam
# https://github.com/ValveSoftware/steam-for-linux/issues/1040
@ -276,19 +288,43 @@ smart_gaps on
gaps outer 0
gaps inner 10
# https://github.com/khamer/base16-i3/tree/master/colors
## Base16 Solarized Light
# Author: Ethan Schoonover (modified by aramisgithub)
#
# You can use these variables anywhere in the i3 configuration file.
set $base00 #fdf6e3
set $base01 #eee8d5
set $base02 #93a1a1
set $base03 #839496
set $base04 #657b83
set $base05 #586e75
set $base06 #073642
set $base07 #002b36
#set $base00 #fdf6e3
#set $base01 #eee8d5
#set $base02 #93a1a1
#set $base03 #839496
#set $base04 #657b83
#set $base05 #586e75
#set $base06 #073642
#set $base07 #002b36
#set $base08 #dc322f
#set $base09 #cb4b16
#set $base0A #b58900
#set $base0B #859900
#set $base0C #2aa198
#set $base0D #268bd2
#set $base0E #6c71c4
#set $base0F #d33682
## Base16 Solarized Dark
# Author: Ethan Schoonover (modified by aramisgithub)
#
# You can use these variables anywhere in the i3 configuration file.
set $base00 #002b36
set $base01 #073642
set $base02 #586e75
set $base03 #657b83
set $base04 #839496
set $base05 #93a1a1
set $base06 #eee8d5
set $base07 #fdf6e3
set $base08 #dc322f
set $base09 #cb4b16
set $base0A #b58900

View File

@ -1,7 +1,8 @@
general {
# These will be used if not supplied by a module
# Solarized
color = '#073642'
#color = '#073642' # base0
color = '#93a1a1' # base1
color_good = '#859900'
color_degraded = '#b58900'
color_bad = '#dc322f'
@ -12,8 +13,8 @@ py3status {
min_width = 50
separator = True
separator_block_width = 20
# border = '#4c7899'
border = '#073642'
border = '#4c7899'
#border = '#073642'
border_bottom = 0
border_left = 0
border_right = 0

View File

@ -11,8 +11,8 @@ class Py3status:
format = 'GPU: {temp}'
thresholds = [
(0, "good"),
(45, "degraded"),
(60, "bad")
(50, "degraded"),
(70, "bad")
]
def gpu_temp(self):

View File

@ -1,50 +1,51 @@
font_family Fira Mono Medium
bold_font Fira Mono Bold
italic_font Fira Mono Italic
font_family Fira Code Medium
bold_font Fira Code Bold
italic_font Fira Code Italic
bold_italic_font auto
font_size 11.0
window_padding_width 10.0
window_padding_height 10.0
# Base16 Solarized Light - kitty color config
# Base16 Solarized Dark - kitty color config
# Scheme by Ethan Schoonover (modified by aramisgithub)
background #fdf6e3
foreground #586e75
selection_background #586e75
selection_foreground #fdf6e3
url_color #657b83
cursor #586e75
active_border_color #839496
inactive_border_color #eee8d5
active_tab_background #fdf6e3
active_tab_foreground #586e75
inactive_tab_background #eee8d5
inactive_tab_foreground #657b83
background #002b36
foreground #93a1a1
selection_background #93a1a1
selection_foreground #002b36
url_color #839496
cursor #93a1a1
active_border_color #657b83
inactive_border_color #073642
active_tab_background #002b36
active_tab_foreground #93a1a1
inactive_tab_background #073642
inactive_tab_foreground #839496
tab_bar_background #073642
# normal
color0 #fdf6e3
color0 #002b36
color1 #dc322f
color2 #859900
color3 #b58900
color4 #268bd2
color5 #6c71c4
color6 #2aa198
color7 #586e75
color7 #93a1a1
# bright
color8 #839496
color8 #657b83
color9 #dc322f
color10 #859900
color11 #b58900
color12 #268bd2
color13 #6c71c4
color14 #2aa198
color15 #586e75
color15 #fdf6e3
# extended base16 colors
color16 #cb4b16
color17 #d33682
color18 #eee8d5
color19 #93a1a1
color20 #657b83
color21 #073642
color18 #073642
color19 #586e75
color20 #839496
color21 #eee8d5

View File

@ -1,9 +1,9 @@
[xin_0]
file=/home/lanxu/.config/i3/background.png
mode=2
mode=5
bgcolor=#000000
[xin_1]
file=/home/lanxu/.config/i3/background.png
mode=2
mode=5
bgcolor=#000000

View File

@ -1,12 +1,12 @@
[geometry]
posx=616
posy=19
sizex=638
sizey=1059
posx=3205
posy=33
sizex=625
sizey=1037
[nitrogen]
view=icon
view=list
recurse=true
sort=alpha
icon_caps=false
dirs=
dirs=/home/lanxu/.config/i3;

View File

@ -67,6 +67,9 @@ set vcs_backend_hg disabled
set vcs_backend_bzr disabled
set vcs_backend_svn disabled
# Truncate the long commit messages to this length when shown in the statusbar.
set vcs_msg_length 50
# Use one of the supported image preview protocols
set preview_images true
@ -106,12 +109,20 @@ set preview_images true
# while slower, this allows remote previews,
# for example during an ssh session.
# Tmux is unsupported.
#
# * ueberzug:
# Preview images in full color with the external command "ueberzug".
# Images are shown by using a child window.
# Only for users who run X11 in GNU/Linux.
set preview_images_method kitty
# Delay in seconds before displaying an image with the w3m method.
# Increase it in case of experiencing display corruption.
set w3m_delay 0.02
# Manually adjust the w3mimg offset when using a terminal which needs this
set w3m_offset 0
# Default iTerm2 font size (see: preview_images_method: iterm2)
set iterm2_font_width 8
set iterm2_font_height 11
@ -136,6 +147,9 @@ set preview_files true
set preview_directories true
set collapse_preview true
# Wrap long lines in plain text previews?
set wrap_plaintext_previews false
# Save the console history on exit?
set save_console_history true
@ -168,10 +182,10 @@ set display_free_space_in_status_bar true
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window?
# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
set update_title false
# Set the title to "ranger" in the tmux program?
# Set the tmux/screen window-name to "ranger"?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
@ -290,6 +304,14 @@ set global_inode_type_filter
# should be 'false' during start-up, but you can toggle it by pressing F.
set freeze_files false
# Print file sizes in bytes instead of the default human-readable format.
set size_in_bytes false
# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
# give a warning when you nest ranger in a subshell started by ranger.
# Special value "error" makes the warning more visible.
set nested_ranger_warning true
# ===================================================================
# == Local Options
# ===================================================================
@ -337,6 +359,8 @@ map <esc> change_mode normal
map ~ set viewmode!
map i display_file
map <A-j> scroll_preview 1
map <A-k> scroll_preview -1
map ? help
map W display_log
map w taskview_open
@ -348,9 +372,8 @@ map ! console shell%space
map @ console -p6 shell %%s
map # console shell -p%space
map s console shell%space
map r chain draw_possible_programs; console open_with%%space
# map f console find%space
map f console scout -ftsea%space
map r chain draw_possible_programs; console open_with%space
map f console find%space
map cd console cd%space
map <C-p> chain console; eval fm.ui.console.history_move(-1)
@ -359,8 +382,10 @@ map <C-p> chain console; eval fm.ui.console.history_move(-1)
map Mf linemode filename
map Mi linemode fileinfo
map Mm linemode mtime
map Mh linemode humanreadablemtime
map Mp linemode permissions
map Ms linemode sizemtime
map MH linemode sizehumanreadablemtime
map Mt linemode metatitle
# Tagging / Marking
@ -382,6 +407,7 @@ map <F5> copy
map <F6> cut
map <F7> console mkdir%space
map <F8> console delete
#map <F8> console trash
map <F10> exit
# In case you work on a keyboard with dvorak layout
@ -464,8 +490,12 @@ map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map pd console paste dest=
map p`<any> paste dest=%any_path
map p'<any> paste dest=%any_path
map dD console delete
map dT console trash
map dd cut
map ud uncut
@ -566,15 +596,18 @@ map zf console filter%space
copymap zf zz
# Filter stack
map .n console filter_stack add name%space
map .m console filter_stack add mime%space
map .d filter_stack add type d
map .f filter_stack add type f
map .l filter_stack add type l
map .m console filter_stack add mime%space
map .n console filter_stack add name%space
map .# console filter_stack add hash%space
map ." filter_stack add duplicate
map .' filter_stack add unique
map .| filter_stack add or
map .& filter_stack add and
map .! filter_stack add not
map .r console filter_stack rotate
map .r filter_stack rotate
map .c filter_stack clear
map .* filter_stack decompose
map .p filter_stack pop
@ -724,3 +757,6 @@ tmap <delete> eval -q fm.ui.taskview.task_remove()
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>
# Drag'n'Drop using dragon https://github.com/mwh/dragon
map <C-d> shell dragon -a -x %p

View File

@ -26,7 +26,7 @@
# directory | $1 is a directory
# number <n> | change the number of this command to n
# terminal | stdin, stderr and stdout are connected to a terminal
# X | $DISPLAY is not empty (i.e. Xorg runs)
# X | A graphical environment is available (darwin, Xorg, or Wayland)
#
# There are also pseudo-conditions which have a "side effect":
# flag <flags> | Change how the program is run. See below.
@ -48,7 +48,7 @@
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
has xdg-open, flag f = xdg-open "$1"
# has xdg-open, flag f = xdg-open "$1"
#-------------------------------------------
# Websites
#-------------------------------------------
@ -67,13 +67,13 @@ ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
ext x?html?, has midori, X, flag f = midori -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
@ -99,7 +99,7 @@ ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Code
# Scripts
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
@ -168,8 +168,13 @@ ext djvu, has atril, X, flag f = atril -- "$@"
ext djvu, has djview, X, flag f = djview -- "$@"
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf -- "$@"
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext cbr, has zathura, X, flag f = zathura -- "$@"
ext cbz, has zathura, X, flag f = zathura -- "$@"
#-------------------------------------------
# Images
#-------------------------------------------
@ -186,6 +191,7 @@ mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
@ -254,10 +260,29 @@ label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
#-------------------------------------------
# Generic file openers
#-------------------------------------------
label open, has xdg-open = xdg-open -- "$@"
label open, has open = open -- "$@"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
# The very last action, so that it's never triggered accidentally, is to execute a program:
######################################################################
# The actions below are left so low down in this file on purpose, so #
# they are never triggered accidentally. #
######################################################################
# Execute a file as program/script.
mime application/x-executable = "$1"
# Move the file to trash using trash-cli.
label trash, has trash-put = trash-put -- "$@"
label trash = mkdir -p -- ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash; mv -- "$@" ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash
# Drag'n'Drop using dragon https://github.com/mwh/dragon
has dragon, X, flag f = dragon -a -x "$@"

View File

@ -3,29 +3,34 @@
set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'
# If the option `use_preview_script` is set to `true`,
# then this script will be called and its output will be displayed in ranger.
# ANSI color codes are supported.
# STDIN is disabled, so interactive scripts won't work properly
## If the option `use_preview_script` is set to `true`,
## then this script will be called and its output will be displayed in ranger.
## ANSI color codes are supported.
## STDIN is disabled, so interactive scripts won't work properly
# This script is considered a configuration file and must be updated manually.
# It will be left untouched if you upgrade ranger.
## This script is considered a configuration file and must be updated manually.
## It will be left untouched if you upgrade ranger.
# Meanings of exit codes:
# code | meaning | action of ranger
# -----+------------+-------------------------------------------
# 0 | success | Display stdout as preview
# 1 | no preview | Display no preview at all
# 2 | plain text | Display the plain content of the file
# 3 | fix width | Don't reload when width changes
# 4 | fix height | Don't reload when height changes
# 5 | fix both | Don't ever reload
# 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
# 7 | image | Display the file directly as an image
## Because of some automated testing we do on the script #'s for comments need
## to be doubled up. Code that is commented out, because it's an alternative for
## example, gets only one #.
# Script arguments
## Meanings of exit codes:
## code | meaning | action of ranger
## -----+------------+-------------------------------------------
## 0 | success | Display stdout as preview
## 1 | no preview | Display no preview at all
## 2 | plain text | Display the plain content of the file
## 3 | fix width | Don't reload when width changes
## 4 | fix height | Don't reload when height changes
## 5 | fix both | Don't ever reload
## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
## 7 | image | Display the file directly as an image
## Script arguments
FILE_PATH="${1}" # Full path of the highlighted file
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
@ -33,71 +38,93 @@ PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwi
FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')"
# Settings
## Settings
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8}
HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
OPENSCAD_IMGSIZE=${RNGR_OPENSCAD_IMGSIZE:-1000,1000}
OPENSCAD_COLORSCHEME=${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}
handle_extension() {
case "${FILE_EXTENSION_LOWER}" in
# Archive
## 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|tZ|tzo|war|xpi|xz|Z|zip)
atool --list -- "${FILE_PATH}" && exit 5
bsdtar --list --file "${FILE_PATH}" && exit 5
exit 1;;
rar)
# Avoid password prompt by providing empty password
## Avoid password prompt by providing empty password
unrar lt -p- -- "${FILE_PATH}" && exit 5
exit 1;;
7z)
# Avoid password prompt by providing empty password
## Avoid password prompt by providing empty password
7z l -p -- "${FILE_PATH}" && exit 5
exit 1;;
# PDF
#pdf)
# # Preview as text conversion
# pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | fmt -w ${PV_WIDTH} && exit 5
# mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | fmt -w ${PV_WIDTH} && exit 5
# exiftool "${FILE_PATH}" && exit 5
# exit 1;;
## PDF
pdf)
## Preview as text conversion
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \
fmt -w "${PV_WIDTH}" && exit 5
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \
fmt -w "${PV_WIDTH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
# BitTorrent
## BitTorrent
torrent)
transmission-show -- "${FILE_PATH}" && exit 5
exit 1;;
# OpenDocument
## OpenDocument
odt|ods|odp|sxw)
# Preview as text conversion
## Preview as text conversion
odt2txt "${FILE_PATH}" && exit 5
## Preview as markdown conversion
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
exit 1;;
# HTML
## XLSX
xlsx)
## Preview as csv conversion
## Uses: https://github.com/dilshod/xlsx2csv
xlsx2csv -- "${FILE_PATH}" && exit 5
exit 1;;
## HTML
htm|html|xhtml)
# Preview as text conversion
## Preview as text conversion
w3m -dump "${FILE_PATH}" && exit 5
lynx -dump -- "${FILE_PATH}" && exit 5
elinks -dump "${FILE_PATH}" && exit 5
;; # Continue with next handler on failure
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
;;
# JSON
## JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
;;
;;
## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
## by file(1).
dff|dsf|wv|wvc)
mediainfo "${FILE_PATH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
;; # Continue with next handler on failure
esac
}
handle_image() {
# Size of the preview if there are multiple options or it has to be rendered
# from vector graphics. If the conversion program allows specifying only one
# dimension while keeping the aspect ratio, the width will be used.
## Size of the preview if there are multiple options or it has to be
## rendered from vector graphics. If the conversion program allows
## specifying only one dimension while keeping the aspect ratio, the width
## will be used.
local DEFAULT_SIZE="1920x1080"
local mimetype="${1}"
case "${FILE_EXTENSION_LOWER}" in
@ -134,33 +161,32 @@ handle_image() {
# but might fail for unsupported types.
exit 7;;
# Video
video/*)
# Thumbnail
ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
exit 1;;
## Video
# video/*)
# # Thumbnail
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
# exit 1;;
# PDF
application/pdf)
pdftoppm -f 1 -l 1 \
-scale-to-x "${DEFAULT_SIZE%x*}" \
-scale-to-y -1 \
-singlefile \
-jpeg -tiffcompression jpeg \
-- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
&& exit 6 || exit 1;;
# ePub, MOBI, FB2 (using Calibre)
# application/epub+zip|application/x-mobipocket-ebook|application/x-fictionbook+xml)
# ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" > /dev/null \
## PDF
# application/pdf)
# pdftoppm -f 1 -l 1 \
# -scale-to-x "${DEFAULT_SIZE%x*}" \
# -scale-to-y -1 \
# -singlefile \
# -jpeg -tiffcompression jpeg \
# -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
# && exit 6 || exit 1;;
## ePub, MOBI, FB2 (using Calibre)
# application/epub+zip|application/x-mobipocket-ebook|\
# application/x-fictionbook+xml)
# # ePub (using https://github.com/marianosimone/epub-thumbnailer)
# epub-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" \
# "${DEFAULT_SIZE%x*}" && exit 6
# ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" \
# >/dev/null && exit 6
# exit 1;;
# ePub (using <https://github.com/marianosimone/epub-thumbnailer>)
# application/epub+zip)
# epub-thumbnailer \
# "${FILE_PATH}" "${IMAGE_CACHE_PATH}" "${DEFAULT_SIZE%x*}" \
# && exit 6 || exit 1;;
# Font
## Font
application/font*|application/*opentype)
preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
if fontimage -o "${preview_png}" \
@ -181,8 +207,8 @@ handle_image() {
fi
;;
# Preview archives using the first image inside.
# (Very useful for comic book collections for example.)
## Preview archives using the first image inside.
## (Very useful for comic book collections for example.)
# application/zip|application/x-rar|application/x-7z-compressed|\
# application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
# local fn=""; local fe=""
@ -218,14 +244,60 @@ handle_image() {
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
# ;;
esac
# openscad_image() {
# TMPPNG="$(mktemp -t XXXXXX.png)"
# openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \
# --imgsize="${OPENSCAD_IMGSIZE/x/,}" \
# -o "${TMPPNG}" "${1}"
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
# }
# case "${FILE_EXTENSION_LOWER}" in
# ## 3D models
# ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
# ## is hardcoded as jpeg. So we make a tempfile.png and just
# ## move/rename it to jpg. This works because image libraries are
# ## smart enough to handle it.
# csg|scad)
# openscad_image "${FILE_PATH}" && exit 6
# ;;
# 3mf|amf|dxf|off|stl)
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
# ;;
# esac
}
handle_mime() {
local mimetype="${1}"
case "${mimetype}" in
# Text
## RTF and DOC
text/rtf|*msword)
## Preview as text conversion
## note: catdoc does not always work for .doc files
## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
catdoc -- "${FILE_PATH}" && exit 5
exit 1;;
## DOCX, ePub, FB2 (using markdown)
## You might want to remove "|epub" and/or "|fb2" below if you have
## uncommented other methods to preview those formats
*wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
## Preview as markdown conversion
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
exit 1;;
## XLS
*ms-excel)
## Preview as csv conversion
## xls2csv comes with catdoc:
## http://www.wagner.pp.ru/~vitus/software/catdoc/
xls2csv -- "${FILE_PATH}" && exit 5
exit 1;;
## Text
text/* | */xml)
# Syntax highlight
## Syntax highlight
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
exit 2
fi
@ -239,26 +311,27 @@ handle_mime() {
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
--out-format="${highlight_format}" \
--force -- "${FILE_PATH}" && exit 5
env COLORTERM=8bit bat --color=always --style="plain" \
-- "${FILE_PATH}" && exit 5
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
-- "${FILE_PATH}" && exit 5
exit 2;;
# DjVu
## DjVu
image/vnd.djvu)
# Preview as text conversion (requires djvulibre)
djvutxt "${FILE_PATH}" | fmt -w ${PV_WIDTH} && exit 5
## Preview as text conversion (requires djvulibre)
djvutxt "${FILE_PATH}" | fmt -w "${PV_WIDTH}" && exit 5
exiftool "${FILE_PATH}" && exit 5
exit 1;;
# Image
## Image
image/*)
# Preview as text conversion
img2txt --format=utf8 --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
#catimg -w "${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
## Preview as text conversion
img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
#exiftool "${FILE_PATH}" && exit 5
exit 1;;
# Video and audio
## Video and audio
video/* | audio/*)
mediainfo "${FILE_PATH}" && exit 5
exiftool "${FILE_PATH}" && exit 5

5
.vimrc
View File

@ -17,6 +17,7 @@ Plug 'rust-lang/rust.vim', {'for': 'rust'}
" Syntax checking
"Plug 'Valloric/YouCompleteMe' " alternative #1, full-blown
Plug 'w0rp/ale',
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Useful plugins
Plug 'Raimondi/delimitMate'
@ -56,7 +57,7 @@ syntax on
set t_Co=256
set background=light
let base16colorspace=256
colorscheme base16-solarized-light
colorscheme base16-solarized-dark
" Other
set encoding=utf-8
@ -83,7 +84,7 @@ if has("gui_running")
set guioptions-=T " remove toolbar
set guioptions-=r " remove right-hand scroll bar
set guioptions-=L " remove left-hand scroll bar
set guifont=Fira\ Code\ 11
set guifont=Fira\ Code\ Medium\ 11
"set guifont=Fura\ Code\ Nerd\ Font\ 11
set guiheadroom=0
endif

View File

@ -66,3 +66,4 @@ export TERMCMD=$TERMINAL
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi

6
.zshrc
View File

@ -41,7 +41,7 @@ source ~/.zplugins
alias top=htop
alias ll="ls -lh"
alias la="ls -a"
alias lp="lastpass.sh"
alias lp="keepass.sh"
alias ranger="ranger"
alias search="search.sh"
#alias ls="ls -N --time-style=long-iso --color=auto"
@ -56,10 +56,12 @@ alias runwinesteam="MESA_GL_VERSION_OVERRIDE=3.3COMPAT PULSE_LATENCY_MSEC=60 run
alias rbackup="restic -r rclone:hubic:ChimeraLinux"
alias bat="bat --theme base16"
alias wine32="WINEPREFIX=~/.wine32 wine"
alias steam="DBUS_SESSION_BUS_ADDRESS=unix:abstract=/dev/null steam"
# https://github.com/chriskempson/base16-shell
# git clone https://github.com/chriskempson/base16-shell.git ~/.config/base16-shell
#source $HOME/.config/base16-shell/scripts/base16-default-dark.sh
source $HOME/.config/base16-shell/scripts/base16-solarized-light.sh
#source $HOME/.config/base16-shell/scripts/base16-solarized-light.sh
source $HOME/.config/base16-shell/scripts/base16-solarized-dark.sh
# Emscripten
#source /home/lanxu/Koodit/github/emsdk/emsdk_env.sh