mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-03-18 08:09:40 +00:00
update 23.04.2023
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Basic Settings
|
||||
set autoquit on
|
||||
set cleaner ~/.config/lf/cleaner
|
||||
set cleaner "~/.config/lf/cleaner"
|
||||
set drawbox true
|
||||
set hidden true
|
||||
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
|
||||
set icons true
|
||||
set ifs "\n"
|
||||
set ifs "\n"
|
||||
set ignorecase true
|
||||
set info size
|
||||
set period 1
|
||||
set previewer ~/.config/lf/preview
|
||||
set previewer "~/.config/lf/preview"
|
||||
set ratios 1:2:3
|
||||
set scrolloff 10
|
||||
set shellopts '-eu'
|
||||
@@ -21,7 +21,7 @@ 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 | sk | sed 's|~|$HOME|')" &&
|
||||
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk | sed 's|~|$HOME|')" &&
|
||||
for x in $fx; do
|
||||
eval mv -iv \"$x\" \"$dest\"
|
||||
done &&
|
||||
@@ -33,7 +33,7 @@ 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 | sk | sed 's|~|$HOME|')" &&
|
||||
dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk | sed 's|~|$HOME|')" &&
|
||||
for x in $fx; do
|
||||
eval cp -ivr \"$x\" \"$dest\"
|
||||
done &&
|
||||
@@ -56,15 +56,15 @@ cmd open ${{
|
||||
done &
|
||||
;;
|
||||
audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
|
||||
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
|
||||
video/*) setsid -f mpv --speed=2 $f -quiet >/dev/null 2>&1 ;;
|
||||
application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
|
||||
application/pgp-encrypted) $EDITOR $fx ;;
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;;
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;;
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;;
|
||||
application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;;
|
||||
application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;;
|
||||
application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;;
|
||||
# application/vnd.oasis.opendocument.database) setsid -f lobase $fx >/dev/null 2>&1 ;;
|
||||
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done ;;
|
||||
esac
|
||||
}}
|
||||
@@ -75,8 +75,8 @@ cmd extract ${{
|
||||
set -f
|
||||
printf "%s\n\t" "$fx"
|
||||
printf "extract?[y/N]"
|
||||
read ans
|
||||
[ $ans = "y" ] && aunpack $fx
|
||||
read answer
|
||||
[ $answer = "y" ] && aunpack $fx
|
||||
}}
|
||||
|
||||
|
||||
@@ -95,6 +95,11 @@ cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
|
||||
cmd mkfile $touch "$(echo $* | tr ' ' '\ ')"
|
||||
cmd setbg "$1"
|
||||
|
||||
cmd dragon %dragon-drop -a -x $fx
|
||||
cmd dragon-stay %dragon-drop -a %fx
|
||||
cmd dragon-individual %dragon-drop $fx
|
||||
|
||||
|
||||
# Bindings
|
||||
# Remove some defaults
|
||||
map "'"
|
||||
@@ -119,7 +124,7 @@ map <f-2> rename
|
||||
map B $vidir # bulk rename
|
||||
map D delete
|
||||
map E extract
|
||||
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 | sk)"
|
||||
map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' $XDG_CONFIG_HOME/shell/bm-dirs | sk)"
|
||||
map O $mimeopen --ask "$f"
|
||||
map P paste
|
||||
map Y $printf "%s" "$fx" | xclip -selection clipboard
|
||||
@@ -134,5 +139,11 @@ map nN $spacefm -t "${PWD}" & disown >/dev/null 2>&1
|
||||
map nn $setsid -f $TERMINAL >/dev/null 2>&1
|
||||
map o &mimeopen "$f"
|
||||
|
||||
# Dragon Mapping
|
||||
map dr dragon
|
||||
map ds dragon-stay
|
||||
map di dragon-individual
|
||||
|
||||
|
||||
# Source Bookmarks
|
||||
source "~/.config/lf/shortcutrc"
|
||||
|
||||
@@ -6,16 +6,23 @@ 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
|
||||
}
|
||||
# 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"
|
||||
# echo "TRUE"
|
||||
# else
|
||||
# mediainfo "$6"
|
||||
# echo "FALSE"
|
||||
# fi
|
||||
# }
|
||||
|
||||
ifub() {
|
||||
[ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1
|
||||
image() {
|
||||
if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; 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"
|
||||
exit 1
|
||||
else
|
||||
chafa "$1" -s "$4x"
|
||||
fi
|
||||
}
|
||||
|
||||
# Note that the cache file name is a function of file information, meaning if
|
||||
@@ -24,7 +31,7 @@ ifub() {
|
||||
|
||||
case "$(file --dereference --brief --mime-type -- "$1")" in
|
||||
image/svg* | application/illustrator)
|
||||
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)"
|
||||
CACHE="$XDG_CACHE_HOME/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" ] &&
|
||||
convert "$1" "$CACHE.jpg"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5"
|
||||
@@ -33,20 +40,20 @@ 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/markdown) glow -s dark "$1" ;;
|
||||
text/* | */xml | application/json) bat --style=plain "$(($4 - 2))" -f "$1" ;;
|
||||
text/* | */xml | application/json) bat --style=plain --terminal-width "$(($4 - 2))" -f "$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)"
|
||||
CACHE="$XDG_CACHE_HOME/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)"
|
||||
CACHE="$XDG_CACHE_HOME/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"
|
||||
;;
|
||||
*/epub+zip | */mobi*)
|
||||
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)"
|
||||
CACHE="$XDG_CACHE_HOME/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" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
|
||||
;;
|
||||
@@ -58,7 +65,7 @@ application/x-iso*) iso-info "$1" ;;
|
||||
*openxmlformats-officedocument.wordprocessingml.document) docx2txt "$1" - ;;
|
||||
*opendocument*) odt2txt "$1" ;;
|
||||
*ms-excel | *openxmlformats-officedocument.spreadsheetml.sheet)
|
||||
ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv
|
||||
ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | bat --language=csv
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user