This commit is contained in:
ArgentumCation 2023-12-10 16:56:58 -05:00
parent b0f4176c7e
commit 71cec63f8c
10 changed files with 296 additions and 5 deletions

View file

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ -n "$DISPLAY" ]; then
export FIFO_UEBERZUG="${TMPDIR:-/tmp}/lf-ueberzug-$$"
cleanup() {
exec 3>&-
rm "$FIFO_UEBERZUG"
}
mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s <"$FIFO_UEBERZUG" &
exec 3>"$FIFO_UEBERZUG"
trap cleanup EXIT
if ! [ -d "$HOME/.cache/lf" ]; then
mkdir -p "$HOME/.cache/lf"
fi
lf "$@" 3>&-
else
exec lf "$@"
fi

@ -1 +1 @@
Subproject commit c71623380f061609d357fb5a90a15a35eb646d64
Subproject commit 5eddda28973ded9f9721a3772f2d94163e924d8c

View file

@ -0,0 +1,4 @@
#!/bin/sh
if [ -n "$FIFO_UEBERZUG" ]; then
printf '{"action": "remove", "identifier": "preview"}\n' >"$FIFO_UEBERZUG"
fi

View file

@ -0,0 +1,6 @@
#!/bin/sh
if [ -n "$FIFO_UEBERZUG" ]; then
path="$(printf '%s' "$1" | sed 's/\\/\\\\/g;s/"/\\"/g')"
printf '{"action": "add", "identifier": "preview", "x": %d, "y": %d, "width": %d, "height": %d, "scaler": "contain", "scaling_position_x": 0.5, "scaling_position_y": 0.5, "path": "%s"}\n' \
"$4" "$5" "$2" "$3" "$1" >"$FIFO_UEBERZUG"
fi

View file

@ -0,0 +1,44 @@
#!/bin/sh
draw() {
~/.config/lf/draw_img.sh "$@"
exit 1
}
hash() {
printf '%s/.cache/lf/%s' "$HOME" \
"$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
}
cache() {
if [ -f "$1" ]; then
draw "$@"
fi
}
file="$1"
shift
if [ -n "$FIFO_UEBERZUG" ]; then
case "$(file -Lb --mime-type -- "$file")" in
image/*)
orientation="$(identify -format '%[EXIF:Orientation]\n' -- "$file")"
if [ -n "$orientation" ] && [ "$orientation" != 1 ]; then
cache="$(hash "$file").jpg"
cache "$cache" "$@"
convert -- "$file" -auto-orient "$cache"
draw "$cache" "$@"
else
draw "$file" "$@"
fi
;;
video/*)
cache="$(hash "$file").jpg"
cache "$cache" "$@"
ffmpegthumbnailer -i "$file" -o "$cache" -s 0
draw "$cache" "$@"
;;
esac
fi
file -Lb -- "$1" | fold -s -w "$width"
exit 0

View file

@ -71,3 +71,6 @@ cmd gz %tar -czvf "$f.tar.gz" "$f"
cmd zstd %tar -cvf --zstd "$f.tar.zst" "$f"
map au unarchive
set previewer ~/.config/lf/previewer.sh
set cleaner ~/.config/lf/clear_img.sh

View file

@ -0,0 +1,10 @@
# style name or JSON path (default "auto")
style: "~/.config/glow/lunar-witch.json"
# show local files only; no network (TUI-mode only)
local: false
# mouse support (TUI-mode only)
mouse: true
# use pager to display markdown
pager: true
# word-wrap at width
width: 120

View file

@ -0,0 +1,198 @@
{
"document": {
"block_prefix": "\n",
"block_suffix": "\n",
"color": "#EBF6FF",
"margin": 2
},
"block_quote": {
"indent": 1,
"indent_token": "│ "
},
"paragraph": {},
"list": {
"level_indent": 2
},
"heading": {
"block_suffix": "\n",
"color": "#5BCEFA",
"bold": true
},
"h1": {
"prefix": " ",
"suffix": " ",
"color": "#EBF6FF",
"background_color": "#0B5393",
"bold": true
},
"h2": {
"prefix": "## "
},
"h3": {
"prefix": "### "
},
"h4": {
"prefix": "#### "
},
"h5": {
"prefix": "##### "
},
"h6": {
"prefix": "###### ",
"color": "#98DB95",
"bold": false
},
"text": {},
"strikethrough": {
"crossed_out": true
},
"emph": {
"italic": true,
"color": "#F4B766"
},
"strong": {
"bold": true,
"color": "#A34A78"
},
"hr": {
"color": "#808082",
"format": "\n--------\n"
},
"item": {
"block_prefix": "• "
},
"enumeration": {
"block_prefix": ". "
},
"task": {
"ticked": "[✓] ",
"unticked": "[ ] "
},
"link": {
"color": "#445F9B",
"underline": true
},
"link_text": {
"color": "#445F9B",
"bold": true
},
"image": {
"color": "#A34A78",
"underline": true
},
"image_text": {
"color": "#A34A78",
"format": "Image: {{.text}} →"
},
"code": {
"prefix": "`",
"suffix": "`",
"color": "#EBF6FF",
"background_color": "#2A2644"
},
"code_block": {
"color": "#2A97B1",
"background_color": "#2A2644",
"margin": 2,
"chroma": {
"text": {
"color": "#EBF6FF"
},
"error": {
"color": "#EBF6FF",
"background_color": "#A04558"
},
"comment": {
"color": "#BFBFC0"
},
"comment_preproc": {
"color": "#F4B766"
},
"keyword": {
"color": "#0B5393"
},
"keyword_reserved": {
"color": "#EE5E95"
},
"keyword_namespace": {
"color": "#EE5E95"
},
"keyword_type": {
"color": "#445F9B"
},
"operator": {
"color": "#F4B766"
},
"punctuation": {
"color": "#FFE70A"
},
"name": {
"color": "#BFBFC0"
},
"name_builtin": {
"color": "#EE5E95"
},
"name_tag": {
"color": "#A34A78"
},
"name_attribute": {
"color": "#445F9B"
},
"name_class": {
"color": "#EBF6FF",
"underline": true,
"bold": true
},
"name_constant": {},
"name_decorator": {
"color": "#FFE70A"
},
"name_exception": {},
"name_function": {
"color": "#6FA47E"
},
"name_other": {},
"literal": {},
"literal_number": {
"color": "#98DB95"
},
"literal_date": {},
"literal_string": {
"color": "#6FA47E"
},
"literal_string_escape": {
"color": "#6FA47E"
},
"generic_deleted": {
"color": "#F5A9B8"
},
"generic_emph": {
"italic": true
},
"generic_inserted": {
"color": "#98DB95"
},
"generic_strong": {
"bold": true
},
"generic_subheading": {
"color": "#BFBFC0"
},
"background": {
"background_color": "#2A2644"
}
}
},
"table": {
"center_separator": "┼",
"column_separator": "│",
"row_separator": "─"
},
"definition_list": {},
"definition_term": {},
"definition_description": {
"block_prefix": "\n🠶 "
},
"html_block": {},
"html_span": {}
}

View file

@ -40,13 +40,15 @@ super + tab
rofi -show window -show-icons -theme lunar-witch
print
flameshot full -c -p "/home/mira/Pictures/screenshots/"
flameshot full -r -p "/home/mira/Pictures/screenshots/" | wl-copy
shift + print
flameshot gui -s -c -p "/home/mira/Pictures/screenshots/"
flameshot gui -s -r -p "/home/mira/Pictures/screenshots/" | wl-copy
ctrl + print
flameshot gui -c -p "/home/mira/Pictures/screenshots/"
flameshot gui -r -p "/home/mira/Pictures/screenshots/" | wl-copy
super + shift + v
cliphist list | rofi -dmenu -p "Select item to copy" -lines 10 -width 35 -theme lunar-witch | cliphist decode | wl-copy

View file

@ -1,6 +1,6 @@
[preferred]
# use xdg-desktop-portal-gtk for every portal interface
default=wlr;gtk
default=wlr # ;gtk
# except for the xdg-desktop-portal-wlr supplied interfaces
org.freedesktop.impl.portal.Screencast=wlr
org.freedesktop.impl.portal.Screenshot=wlr