From 71cec63f8c85406c534d2f364f3d432bb269d9d8 Mon Sep 17 00:00:00 2001 From: ArgentumCation Date: Sun, 10 Dec 2023 16:56:58 -0500 Subject: [PATCH] updates --- dot_local/bin/executable_lfub | 24 +++ private_dot_config/external_nvim | 2 +- private_dot_config/lf/executable_clear_img.sh | 4 + private_dot_config/lf/executable_draw_img.sh | 6 + private_dot_config/lf/executable_previewer.sh | 44 ++++ private_dot_config/lf/lfrc | 3 + private_dot_config/private_glow/glow.yml | 10 + .../private_glow/lunar-witch.json | 198 ++++++++++++++++++ private_dot_config/swhkd/swhkdrc | 8 +- .../xdg-desktop-portal/sway-portals.conf | 2 +- 10 files changed, 296 insertions(+), 5 deletions(-) create mode 100644 dot_local/bin/executable_lfub create mode 100644 private_dot_config/lf/executable_clear_img.sh create mode 100644 private_dot_config/lf/executable_draw_img.sh create mode 100644 private_dot_config/lf/executable_previewer.sh create mode 100644 private_dot_config/private_glow/glow.yml create mode 100644 private_dot_config/private_glow/lunar-witch.json diff --git a/dot_local/bin/executable_lfub b/dot_local/bin/executable_lfub new file mode 100644 index 0000000..224f19b --- /dev/null +++ b/dot_local/bin/executable_lfub @@ -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 diff --git a/private_dot_config/external_nvim b/private_dot_config/external_nvim index c716233..5eddda2 160000 --- a/private_dot_config/external_nvim +++ b/private_dot_config/external_nvim @@ -1 +1 @@ -Subproject commit c71623380f061609d357fb5a90a15a35eb646d64 +Subproject commit 5eddda28973ded9f9721a3772f2d94163e924d8c diff --git a/private_dot_config/lf/executable_clear_img.sh b/private_dot_config/lf/executable_clear_img.sh new file mode 100644 index 0000000..a6145e8 --- /dev/null +++ b/private_dot_config/lf/executable_clear_img.sh @@ -0,0 +1,4 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "preview"}\n' >"$FIFO_UEBERZUG" +fi diff --git a/private_dot_config/lf/executable_draw_img.sh b/private_dot_config/lf/executable_draw_img.sh new file mode 100644 index 0000000..e5bbd09 --- /dev/null +++ b/private_dot_config/lf/executable_draw_img.sh @@ -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 diff --git a/private_dot_config/lf/executable_previewer.sh b/private_dot_config/lf/executable_previewer.sh new file mode 100644 index 0000000..8d4bbbe --- /dev/null +++ b/private_dot_config/lf/executable_previewer.sh @@ -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 diff --git a/private_dot_config/lf/lfrc b/private_dot_config/lf/lfrc index 456f92e..8420507 100644 --- a/private_dot_config/lf/lfrc +++ b/private_dot_config/lf/lfrc @@ -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 diff --git a/private_dot_config/private_glow/glow.yml b/private_dot_config/private_glow/glow.yml new file mode 100644 index 0000000..5de916c --- /dev/null +++ b/private_dot_config/private_glow/glow.yml @@ -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 diff --git a/private_dot_config/private_glow/lunar-witch.json b/private_dot_config/private_glow/lunar-witch.json new file mode 100644 index 0000000..f33d5db --- /dev/null +++ b/private_dot_config/private_glow/lunar-witch.json @@ -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": {} +} diff --git a/private_dot_config/swhkd/swhkdrc b/private_dot_config/swhkd/swhkdrc index e5cec02..726b2a5 100644 --- a/private_dot_config/swhkd/swhkdrc +++ b/private_dot_config/swhkd/swhkdrc @@ -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 diff --git a/private_dot_config/xdg-desktop-portal/sway-portals.conf b/private_dot_config/xdg-desktop-portal/sway-portals.conf index 9372366..5e28540 100644 --- a/private_dot_config/xdg-desktop-portal/sway-portals.conf +++ b/private_dot_config/xdg-desktop-portal/sway-portals.conf @@ -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