From ed19a335685621fb7e0cbaf06a1936f66760910a Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 25 Mar 2025 23:30:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-25 23:30:07 --- .config/aerc/paste-attachment.sh | 40 +---------------------------- .config/mail/format.py | 43 +------------------------------- 2 files changed, 2 insertions(+), 81 deletions(-) mode change 100755 => 120000 .config/aerc/paste-attachment.sh mode change 100755 => 120000 .config/mail/format.py diff --git a/.config/aerc/paste-attachment.sh b/.config/aerc/paste-attachment.sh deleted file mode 100755 index 69d93849..00000000 --- a/.config/aerc/paste-attachment.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/env bash - -# check that clipboard doesn't contain text -if wl-paste --list-types | grep -qv '^text/plain$'; then - tempdir=$(mktemp -d) - extension=$(grep -E "^$(wl-paste --list-types)" /etc/mime.types | awk '{print $2}') - echo -n "Enter file name (extension .$extension will be appended): " >&2 - read -e -r user_input - attachment="$tempdir/$user_input.$extension" - read -e -r -p "$(printf "Your file will be written to %s and attached. \n\nConfirm (y/n): " "$attachment" >&2)" confirm - case "$confirm" in - y) - wl-paste >"$attachment" - echo "$attachment" - ;; - *) - exit 1 - ;; - esac -else - # clipboard contains a string (treat as path) - out=$(wl-paste) - if wl-paste --list-types | grep -q '^text/uri-list$' && wl-paste | grep -q '^file://'; then - out=${out#file://} - fi - if [ ! -f "$out" ]; then - read -e -r -p "$(printf "Your clipboard contains %s, which is not a valid attachment. \n\nPress enter to continue." "$out" >&2)" - exit 1 - fi - read -e -r -p "$(printf "Your clipboard contains %s, which will be attached as a path. \n\nConfirm (y/n): " "$out" >&2)" confirm - case "$confirm" in - y) - echo "$out" - ;; - *) - exit 1 - ;; - esac -fi diff --git a/.config/aerc/paste-attachment.sh b/.config/aerc/paste-attachment.sh new file mode 120000 index 00000000..fe0d1d94 --- /dev/null +++ b/.config/aerc/paste-attachment.sh @@ -0,0 +1 @@ +/home/fic/dev/mail-utils/paste-attachment.sh \ No newline at end of file diff --git a/.config/mail/format.py b/.config/mail/format.py deleted file mode 100755 index cc84184f..00000000 --- a/.config/mail/format.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/env python - -# Simple text-wrapping script for email. -# Preserves code blocks, quotes, and signature. -# Automatically joins and re-wraps paragraphs to -# ensure even spacing & avoid ugly wrapping. -# Author: Daniel Fichtinger -# License: MIT - -import textwrap -import sys -import re - -paragraph = [] -skipping = False - -def flush_paragraph(): - if paragraph: - joined = " ".join(paragraph) - wrapped = textwrap.wrap(joined, width=74, break_long_words=False, replace_whitespace=True) - print("\n".join(wrapped)) - paragraph.clear() - -for line in sys.stdin: - line = line.rstrip() - if line.startswith("```"): - flush_paragraph() - skipping = not skipping - print(line) - elif line.startswith("--"): - flush_paragraph() - skipping = True - print(line) - elif not line or re.match(r"^(\s+|-\s+|\+\s+|\*\s+|>\s*)", line): - flush_paragraph() - print(line) - elif skipping: - print(line) - else: - paragraph.append(line) -else: - flush_paragraph() diff --git a/.config/mail/format.py b/.config/mail/format.py new file mode 120000 index 00000000..182fea4b --- /dev/null +++ b/.config/mail/format.py @@ -0,0 +1 @@ +/home/fic/dev/mail-utils/format.py \ No newline at end of file