Updated dotfiles to the latest

This commit is contained in:
lanxu 2019-03-23 17:28:58 +02:00
parent 1af53a1c96
commit 379ebcf00d
51 changed files with 318 additions and 51 deletions

View File

@ -0,0 +1,53 @@
local naughty = require("naughty")
local wibox = require("wibox")
local json = require("lanxu/dkjson")
local gears = require("gears")
local focused = require("awful.screen").focused
local easy_async = require("awful.spawn").easy_async
local function factory(args)
local args = args or {}
local calluri = args.uri or "https://api.ipify.org"
local settings = args.settings or function() end
local homeaddress = args.homeaddress or nil
local ip = { widget = wibox.widget.textbox() }
ip.widget:set_markup("N/A")
function ip.attach(obj)
obj:connect_signal("button::press", function()
ip.update()
end)
end
function ip.update()
local cmd = string.format("curl -s " .. "'" .. calluri .. "'")
address = "N/A"
settings()
easy_async(cmd, function(response, stderr, reason, exit_code)
address = response
address = string.gsub(address, "[^0-9.]", "")
if address == homeaddress then
address = "Home"
end
ip.address = address
widget = ip.widget
settings()
end)
end
ip.attach(ip.widget)
address = "N/A"
settings()
ip.update()
return ip
end
return factory

View File

@ -260,8 +260,8 @@ awful.screen.connect_for_each_screen(function(s)
spacer, spacer,
mydpmsstatus, mydpmsstatus,
spacer, spacer,
mycloudstatus, --mycloudstatus,
spacer, --spacer,
mycpu, mycpu,
spacer, spacer,
mymem, mymem,
@ -269,11 +269,8 @@ awful.screen.connect_for_each_screen(function(s)
myweather, myweather,
spacer, spacer,
mycputemp, mycputemp,
spacer,
mygputemp, mygputemp,
spacer,
mytextclock, mytextclock,
spacer,
s.mylayoutbox, s.mylayoutbox,
} }
-- Only show everything on the first screen -- Only show everything on the first screen

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

View File

@ -5,10 +5,16 @@ local lain = require("lain")
local vicious = require("vicious") -- Custom local vicious = require("vicious") -- Custom
local beautiful = require("beautiful") -- CPU temp local beautiful = require("beautiful") -- CPU temp
local wibox = require("wibox") local wibox = require("wibox")
local gears = require("gears")
-- Variables -- Variables
local valuecolor = "white" local valuecolor = "white"
icons_dir = os.getenv("HOME") .. "/.config/awesome/themes/lanxu/icons/"
cpuicon = wibox.widget.imagebox()
cpuicon.image = icons_dir .. "cpu.png"
cpuicon.resize = false
-- Helpers -- Helpers
function file_exists(name) function file_exists(name)
local f = io.open(name,"r") local f = io.open(name,"r")
@ -39,8 +45,18 @@ mymem = lain.widget.mem({
}) })
-- GPU -- GPU
mygputemp = wibox.widget.textbox() mygputemp_text = wibox.widget.textbox()
vicious.register(mygputemp, gputemp, create_markup("GPU", "$0", "", valuecolor), 15, "AMD") mygputemp_text.align = "center"
vicious.register(mygputemp_text, gputemp,
function(widget, args)
temp = string.format("%.0f", tonumber(args[0]))
return create_markup("", temp, "", valuecolor)
end, 15, "AMD")
mygputemp = wibox.container.background()
mygputemp.forced_width = 70
mygputemp:set_widget(mygputemp_text)
--mytextclock:set_shape(gears.shape.hexagon)
mygputemp:set_bg('#5e35b1')
-- Hubic -- Hubic
myhubic = wibox.widget.textbox() myhubic = wibox.widget.textbox()
@ -62,27 +78,42 @@ volume = lain.widget.pulse({
}) })
-- Text clock -- Text clock
mytextclock = wibox.widget.textclock(create_markup("Date","%Y-%m-%d %H:%M","", valuecolor)) mytextclock_text = wibox.widget.textclock(create_markup("","%Y-%m-%d %H:%M","", valuecolor))
mytextclock_text.align = "center"
lain.widget.calendar({ lain.widget.cal({
followtag = true, followtag = true,
attach_to = {mytextclock} attach_to = {mytextclock_text},
notification_preset = {
font = "Monospace 11", fg = "#FFFFFF", bg = "#000000"
}
}) })
mytextclock = wibox.container.background()
mytextclock.forced_width = 130
mytextclock:set_widget(mytextclock_text)
mytextclock:set_bg('#512da8')
-- CPU temperature -- CPU temperature
local tempfile = "/sys/bus/pci/drivers/k10temp/0000:00:18.3/hwmon/hwmon2/temp1_input" local tempfile = "/sys/bus/pci/drivers/k10temp/0000:00:18.3/hwmon/hwmon1/temp1_input"
--local tempfile = "/sys/bus/pci/drivers/k10temp/0000:00:18.3/hwmon/hwmon2/temp1_input"
if file_exists(tempfile) == false then if file_exists(tempfile) == false then
tempfile = "/sys/class/thermal/thermal_zone0/temp" tempfile = "/sys/class/thermal/thermal_zone0/temp"
end end
mycputemp = lain.widget.temp({ mycputemp_text = lain.widget.temp({
tempfile = tempfile, tempfile = tempfile,
settings = function() settings = function()
widget.markup = create_markup("CPU", coretemp_now, "", valuecolor) temp = string.format("%.0f", tonumber(coretemp_now))
widget.markup = create_markup("", temp, "", valuecolor)
end end
}) })
mycputemp_text.widget.align = "center"
mycputemp = wibox.container.background()
mycputemp.forced_width = 70
mycputemp:set_widget(mycputemp_text.widget)
mycputemp:set_bg('#9575cd')
-- Weather Widget -- Weather Widget
myweather = lain.widget.weather({ myweather = lain.widget.weather({
city_id = 634963, city_id = 634963,
@ -90,11 +121,19 @@ myweather = lain.widget.weather({
followtag = true, followtag = true,
settings = function() settings = function()
widget.markup = create_markup("Tampere", weather_now.main.temp, "", valuecolor) widget.markup = create_markup("Tampere", weather_now.main.temp, "", valuecolor)
end end,
notification_preset = {
font = "Monospace 11", fg = "#FFFFFF", bg = "#000000"
}
}) })
-- DPMS -- DPMS
mydpmsstatus = wibox.widget.textbox() mydpmsstatus = wibox.widget.textbox()
-- mydpmsstatus.container.background.bg = '#ff0000'
--mydpmsstatus = {
-- widget = wibox.widget.textbox
--}
vicious.register(mydpmsstatus, dpmsstatus, function(widget, args) vicious.register(mydpmsstatus, dpmsstatus, function(widget, args)
color = valuecolor color = valuecolor
if args[0] == "Enabled" then if args[0] == "Enabled" then
@ -109,21 +148,21 @@ local notification = {
font = "Monospace 10" font = "Monospace 10"
} }
-- Servers -- Servers
local mcstatus = require("lanxu/mcstatus") --local mcstatus = require("lanxu/mcstatus")
myserverstatus = mcstatus({ --myserverstatus = mcstatus({
notification_preset = notification, --notification_preset = notification,
settings = function() --settings = function()
widget.markup = create_markup("PLAYERS", totalplayers, "", valuecolor) --widget.markup = create_markup("PLAYERS", totalplayers, "", valuecolor)
end --end
}) --})
local cloudstatus = require("lanxu/cloudstatus") --local cloudstatus = require("lanxu/cloudstatus")
mycloudstatus = cloudstatus({ --mycloudstatus = cloudstatus({
notification_preset = notification, --notification_preset = notification,
settings = function() --settings = function()
widget.markup = create_markup("CLOUD", currentstatus, "", valuecolor) --widget.markup = create_markup("CLOUD", currentstatus, "", valuecolor)
end --end
}) --})
local ip = require("lanxu/ip") local ip = require("lanxu/ip")
ipaddress = ip({ ipaddress = ip({
@ -132,3 +171,4 @@ ipaddress = ip({
widget.markup = create_markup("IP", address, "", valuecolor) widget.markup = create_markup("IP", address, "", valuecolor)
end end
}) })

View File

@ -1,7 +1,8 @@
# =================================================================== # ===================================================================
# This file contains the default startup commands for ranger. # This file contains the default startup commands for ranger.
# To change them, it is recommended to create the file # To change them, it is recommended to create either /etc/ranger/rc.conf
# ~/.config/ranger/rc.conf and add your custom commands there. # (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
# commands there.
# #
# If you copy this whole file there, you may want to set the environment # If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. # variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
@ -85,6 +86,10 @@ set preview_images true
# width of 8 and height of 11 are used. To use other values, set the options # width of 8 and height of 11 are used. To use other values, set the options
# iterm2_font_width and iterm2_font_height to the desired values. # iterm2_font_width and iterm2_font_height to the desired values.
# #
# * terminology:
# Previews images in full color in the terminology terminal emulator.
# Supports a wide variety of formats, even vector graphics like svg.
#
# * urxvt: # * urxvt:
# Preview images in full color using urxvt image backgrounds. This # Preview images in full color using urxvt image backgrounds. This
# requires using urxvt compiled with pixbuf support. # requires using urxvt compiled with pixbuf support.
@ -92,7 +97,28 @@ set preview_images true
# * urxvt-full: # * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the # The same as urxvt but utilizing not only the preview pane but the
# whole terminal window. # whole terminal window.
set preview_images_method w3m #
# * kitty:
# Preview images in full color using kitty image protocol.
# Requires python PIL or pillow library.
# If ranger does not share the local filesystem with kitty
# the transfer method is changed to encode the whole image;
# 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 ueberzug
# 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) # Default iTerm2 font size (see: preview_images_method: iterm2)
set iterm2_font_width 8 set iterm2_font_width 8
@ -101,6 +127,10 @@ set iterm2_font_height 11
# Use a unicode "..." character to mark cut-off filenames? # Use a unicode "..." character to mark cut-off filenames?
set unicode_ellipsis false set unicode_ellipsis false
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
# Requires the python-bidi pip package
set bidi_support false
# Show dotfiles in the bookmark preview box? # Show dotfiles in the bookmark preview box?
set show_hidden_bookmarks true set show_hidden_bookmarks true
@ -124,8 +154,11 @@ set status_bar_on_top false
# currently running tasks which support progress bars? # currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true set draw_progress_bar_in_status_bar true
# Draw borders around columns? # Draw borders around columns? (separators, outline, both, or none)
set draw_borders false # Separators are vertical lines between columns.
# Outline draws a box around all the columns.
# Both combines the two.
set draw_borders none
# Display the directory name in tabs? # Display the directory name in tabs?
set dirname_in_tabs false set dirname_in_tabs false
@ -137,6 +170,9 @@ set mouse_enabled true
set display_size_in_main_column true set display_size_in_main_column true
set display_size_in_status_bar true set display_size_in_status_bar true
# Display the free disk space in the status bar?
set display_free_space_in_status_bar true
# Display files tags in all columns or only in main column? # Display files tags in all columns or only in main column?
set display_tags_in_all_columns true set display_tags_in_all_columns true
@ -144,7 +180,7 @@ set display_tags_in_all_columns true
set update_title false set update_title false
# Set the title to "ranger" in the tmux program? # Set the title to "ranger" in the tmux program?
set update_tmux_title false set update_tmux_title true
# Shorten the title if it gets long? The number defines how many # Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature. # directories are displayed at once, 0 turns off this feature.
@ -216,6 +252,10 @@ set cd_tab_fuzzy false
# disable this feature. # disable this feature.
set preview_max_size 0 set preview_max_size 0
# The key hint lists up to this size have their sublists expanded.
# Otherwise the submaps are replaced with "...".
set hint_collapse_threshold 10
# Add the highlighted file to the path in the titlebar # Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true set show_selection_in_titlebar true
@ -232,9 +272,14 @@ set metadata_deep_search false
# Clear all existing filters when leaving a directory # Clear all existing filters when leaving a directory
set clear_filters_on_dir_change false set clear_filters_on_dir_change false
# Disable displaying line numbers in main column # Disable displaying line numbers in main column.
# Possible values: false, absolute, relative.
set line_numbers false set line_numbers false
# When line_numbers=relative show the absolute line number in the
# current line.
set relative_current_zero false
# Start line numbers from 1 instead of 0 # Start line numbers from 1 instead of 0
set one_indexed false set one_indexed false
@ -249,6 +294,13 @@ set wrap_scroll false
# directories, files and symlinks respectively. # directories, files and symlinks respectively.
set global_inode_type_filter set global_inode_type_filter
# This setting allows to freeze the list of files to save I/O bandwidth. It
# 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
# =================================================================== # ===================================================================
# == Local Options # == Local Options
# =================================================================== # ===================================================================
@ -270,8 +322,8 @@ alias qall quitall
alias qall! quitall! alias qall! quitall!
alias setl setlocal alias setl setlocal
alias filter scout -prt alias filter scout -prts
alias find scout -aeit alias find scout -aets
alias mark scout -mr alias mark scout -mr
alias unmark scout -Mr alias unmark scout -Mr
alias search scout -rs alias search scout -rs
@ -296,6 +348,8 @@ map <esc> change_mode normal
map ~ set viewmode! map ~ set viewmode!
map i display_file map i display_file
map <A-j> scroll_preview 1
map <A-k> scroll_preview -1
map ? help map ? help
map W display_log map W display_log
map w taskview_open map w taskview_open
@ -311,6 +365,8 @@ map r chain draw_possible_programs; console open_with%%space
map f console find%space map f console find%space
map cd console cd%space map cd console cd%space
map <C-p> chain console; eval fm.ui.console.history_move(-1)
# Change the line mode # Change the line mode
map Mf linemode filename map Mf linemode filename
map Mi linemode fileinfo map Mi linemode fileinfo
@ -374,6 +430,7 @@ map L history_go 1
map ] move_parent 1 map ] move_parent 1
map [ move_parent -1 map [ move_parent -1
map } traverse map } traverse
map { traverse_backwards
map ) jump_non map ) jump_non
map gh cd ~ map gh cd ~
@ -385,9 +442,10 @@ map gL cd -r %f
map go cd /opt map go cd /opt
map gv cd /var map gv cd /var
map gm cd /media map gm cd /media
map gi eval fm.cd('/run/media/' + os.getenv('USER'))
map gM cd /mnt map gM cd /mnt
map gs cd /srv map gs cd /srv
map gt cd /tmp map gp cd /tmp
map gr cd / map gr cd /
map gR eval fm.cd(ranger.RANGERDIR) map gR eval fm.cd(ranger.RANGERDIR)
map g/ cd / map g/ cd /
@ -400,6 +458,7 @@ map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp yank path map yp yank path
map yd yank dir map yd yank dir
map yn yank name map yn yank name
map y. yank name_without_extension
# Filesystem Operations # Filesystem Operations
map = chmod map = chmod
@ -474,6 +533,8 @@ map <a-6> tab_open 6
map <a-7> tab_open 7 map <a-7> tab_open 7
map <a-8> tab_open 8 map <a-8> tab_open 8
map <a-9> tab_open 9 map <a-9> tab_open 9
map <a-r> tab_shift 1
map <a-l> tab_shift -1
# Sorting # Sorting
map or set sort_reverse! map or set sort_reverse!
@ -503,6 +564,8 @@ map zc set collapse_preview!
map zd set sort_directories_first! map zd set sort_directories_first!
map zh set show_hidden! map zh set show_hidden!
map <C-h> set show_hidden! map <C-h> set show_hidden!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
map zI set flushinput! map zI set flushinput!
map zi set preview_images! map zi set preview_images!
map zm set mouse_enabled! map zm set mouse_enabled!
@ -514,6 +577,21 @@ map zv set use_preview_script!
map zf console filter%space map zf console filter%space
copymap zf zz 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 .| filter_stack add or
map .& filter_stack add and
map .! filter_stack add not
map .r console filter_stack rotate
map .c filter_stack clear
map .* filter_stack decompose
map .p filter_stack pop
map .. filter_stack show
# Bookmarks # Bookmarks
map `<any> enter_bookmark %any map `<any> enter_bookmark %any
map '<any> enter_bookmark %any map '<any> enter_bookmark %any
@ -558,8 +636,11 @@ cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1) cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True) cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True) cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-left> eval fm.ui.console.move_word(left=1) cmap <a-b> eval fm.ui.console.move_word(left=1)
cmap <a-right> eval fm.ui.console.move_word(right=1) cmap <a-f> eval fm.ui.console.move_word(right=1)
copycmap <a-b> <a-left>
copycmap <a-f> <a-right>
# Line Editing # Line Editing
cmap <backspace> eval fm.ui.console.delete(-1) cmap <backspace> eval fm.ui.console.delete(-1)
@ -571,6 +652,7 @@ cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste() cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way # And of course the emacs way
copycmap <ESC> <C-g>
copycmap <up> <C-p> copycmap <up> <C-p>
copycmap <down> <C-n> copycmap <down> <C-n>
copycmap <left> <C-b> copycmap <left> <C-b>

View File

@ -31,7 +31,7 @@ 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. PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
FILE_EXTENSION="${FILE_PATH##*.}" FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER="${FILE_EXTENSION,,}" FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')"
# Settings # Settings
HIGHLIGHT_SIZE_MAX=262143 # 256KiB HIGHLIGHT_SIZE_MAX=262143 # 256KiB
@ -60,9 +60,10 @@ handle_extension() {
# PDF # PDF
#pdf) #pdf)
# # Preview as text conversion # # Preview as text conversion
# pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - && exit 5 # 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 # exiftool "${FILE_PATH}" && exit 5
# exit 1;; # exit 1;;
# BitTorrent # BitTorrent
torrent) torrent)
@ -82,10 +83,20 @@ handle_extension() {
lynx -dump -- "${FILE_PATH}" && exit 5 lynx -dump -- "${FILE_PATH}" && exit 5
elinks -dump "${FILE_PATH}" && exit 5 elinks -dump "${FILE_PATH}" && exit 5
;; # Continue with next handler on failure ;; # Continue with next handler on failure
# JSON
json)
jq --color-output . "${FILE_PATH}" && exit 5
python -m json.tool -- "${FILE_PATH}" && exit 5
;;
esac esac
} }
handle_image() { 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.
local DEFAULT_SIZE="1920x1080"
local mimetype="${1}" local mimetype="${1}"
case "${FILE_EXTENSION_LOWER}" in case "${FILE_EXTENSION_LOWER}" in
@ -98,9 +109,15 @@ handle_image() {
case "${mimetype}" in case "${mimetype}" in
# SVG # SVG
image/svg+xml) image/svg+xml)
convert "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
exit 1;; exit 1;;
# DjVu
# image/vnd.djvu)
# ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \
# - "${IMAGE_CACHE_PATH}" < "${FILE_PATH}" \
# && exit 6 || exit 1;;
# Image # Image
image/*) image/*)
local orientation local orientation
@ -125,12 +142,80 @@ handle_image() {
# PDF # PDF
application/pdf) application/pdf)
pdftoppm -f 1 -l 1 \ pdftoppm -f 1 -l 1 \
-scale-to-x 1920 \ -scale-to-x "${DEFAULT_SIZE%x*}" \
-scale-to-y -1 \ -scale-to-y -1 \
-singlefile \ -singlefile \
-jpeg -tiffcompression jpeg \ -jpeg -tiffcompression jpeg \
-- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \ -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
&& exit 6 || exit 1;; && 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 \
# && 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
application/font*|application/*opentype)
preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
if fontimage -o "${preview_png}" \
--pixelsize "120" \
--fontname \
--pixelsize "80" \
--text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
--text " abcdefghijklmnopqrstuvwxyz " \
--text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
--text " The quick brown fox jumps over the lazy dog. " \
"${FILE_PATH}";
then
convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
&& rm "${preview_png}" \
&& exit 6
else
exit 1
fi
;;
# 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=""
# local zip=""; local rar=""; local tar=""; local bsd=""
# case "${mimetype}" in
# application/zip) zip=1 ;;
# application/x-rar) rar=1 ;;
# application/x-7z-compressed) ;;
# *) tar=1 ;;
# esac
# { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
# { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
#
# fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
# [ print(l, end='') for l in sys.stdin if \
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
# sort -V | head -n 1)
# [ "$fn" = "" ] && return
# [ "$bsd" ] && fn=$(printf '%b' "$fn")
#
# [ "$tar" ] && tar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
# fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
# [ "$bsd" ] && bsdtar --extract --to-stdout \
# --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
# [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
# [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
# "${IMAGE_CACHE_PATH}" && exit 6
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
# ;;
esac esac
} }
@ -155,6 +240,13 @@ handle_mime() {
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5 # pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
exit 2;; exit 2;;
# DjVu
image/vnd.djvu)
# 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/*) image/*)
# Preview as text conversion # Preview as text conversion

4
.vimrc
View File

@ -38,8 +38,8 @@ Plug 'honza/vim-snippets'
"Plug 'tomasr/molokai' "Plug 'tomasr/molokai'
"Plug 'flazz/vim-colorschemes' "Plug 'flazz/vim-colorschemes'
"Plug 'morhetz/gruvbox' "Plug 'morhetz/gruvbox'
Plug 'chriskempson/base16-vim' "Plug 'chriskempson/base16-vim' " Original but not updated
Plug 'danielwe/base16-vim' " Fork. updated. https://github.com/chriskempson/base16-vim/issues/197
" Airline " Airline
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'

View File

@ -53,3 +53,6 @@ export PATH="$NPM_PACKAGES/bin:$PATH"
# Rust # Rust
export PATH="${HOME}/.cargo/bin:$PATH" export PATH="${HOME}/.cargo/bin:$PATH"
# Caffe
export CAFFE_DIR="${HOME}/Koodit/github/caffe/build/install"

4
.zshrc
View File

@ -44,7 +44,7 @@ alias lp="lastpass.sh"
alias ranger="TERMCMD=termite ranger" alias ranger="TERMCMD=termite ranger"
alias search="search.sh" alias search="search.sh"
#alias ls="ls -N --time-style=long-iso --color=auto" #alias ls="ls -N --time-style=long-iso --color=auto"
alias ls="ls --time-style=long-iso --color=auto" alias ls="ls --time-style=long-iso --color=auto --human-readable --group-directories-first --classify"
alias rhc='RUBYOPT="-W0" rhc' alias rhc='RUBYOPT="-W0" rhc'
# Other # Other
alias fixsteam='find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete' alias fixsteam='find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete'
@ -52,7 +52,7 @@ alias runsteam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /us
alias steamgamesdir='cd ~/.local/share/Steam/SteamApps/common' alias steamgamesdir='cd ~/.local/share/Steam/SteamApps/common'
alias emsdksetup='source $EMSDK/emsdk_env.sh' alias emsdksetup='source $EMSDK/emsdk_env.sh'
alias runwinesteam="MESA_GL_VERSION_OVERRIDE=3.3COMPAT PULSE_LATENCY_MSEC=60 run-desktop.py ~/.local/share/applications/wine/Programs/Steam/Steam.desktop" alias runwinesteam="MESA_GL_VERSION_OVERRIDE=3.3COMPAT PULSE_LATENCY_MSEC=60 run-desktop.py ~/.local/share/applications/wine/Programs/Steam/Steam.desktop"
alias rbackup="restic -r rclone:hubic:default/Backups/ChimeraLinux" alias rbackup="restic -r rclone:hubic:ChimeraLinux"
# https://github.com/chriskempson/base16-shell # https://github.com/chriskempson/base16-shell
# git clone https://github.com/chriskempson/base16-shell.git ~/.config/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-default-dark.sh