From b9ed4072f2a1c87e14ac730bb50ce9fa925aaec9 Mon Sep 17 00:00:00 2001 From: Uyanide Date: Sat, 24 Jan 2026 23:16:59 +0100 Subject: [PATCH] minor --- config/niri/.config/niri/config/envs.kdl | 4 +- .../scripts/.local/scripts/change-wallpaper | 80 ++++++++++--------- config/wallpaper/Pictures/backgrounds | 2 +- memo/mail-service.md | 19 ++--- 4 files changed, 56 insertions(+), 49 deletions(-) diff --git a/config/niri/.config/niri/config/envs.kdl b/config/niri/.config/niri/config/envs.kdl index eee5e66..5d22f99 100644 --- a/config/niri/.config/niri/config/envs.kdl +++ b/config/niri/.config/niri/config/envs.kdl @@ -19,8 +19,8 @@ environment { WLR_NO_HARDWARE_CURSORS "1" // Nvidia Prime - // __NV_PRIME_RENDER_OFFLOAD "1"; - // __VK_LAYER_NV_optimus "NVIDIA_only" + __NV_PRIME_RENDER_OFFLOAD "1"; + __VK_LAYER_NV_optimus "NVIDIA_only" // Fix Swing _JAVA_AWT_WM_NONREPARENTING "1" diff --git a/config/scripts/.local/scripts/change-wallpaper b/config/scripts/.local/scripts/change-wallpaper index 73c9717..daa484b 100755 --- a/config/scripts/.local/scripts/change-wallpaper +++ b/config/scripts/.local/scripts/change-wallpaper @@ -11,12 +11,13 @@ # - change-colortheme (from scripts/change-colortheme) # - flock (usually part of util-linux) +set -euo pipefail + +trap 'echo $LINENO: $BASH_COMMAND' ERR + # Lock -exec {LOCK_FD}>/tmp/"$(basename "$0")".lock || { - echo "Failed to open lock file" - exit 1 -} +exec {LOCK_FD}>/tmp/"$(basename "$0")".lock flock -n "$LOCK_FD" || { echo "Another instance is running. Exiting." @@ -26,7 +27,7 @@ flock -n "$LOCK_FD" || { # Open a file selection dialog if no argument is provided -if [ -z "$1" ]; then +if [ -z "${1-}" ]; then image=$(zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png *.webp *.bmp *.jfif *.tiff *.avif *.heic *.heif") else image="$1" @@ -37,8 +38,8 @@ fi # Obtain screen resolution -screen_width=$2 -screen_height=$3 +screen_width=${2-} +screen_height=${3-} [ -z "$screen_width" ] && { if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then @@ -56,8 +57,9 @@ screen_height=$3 fi } -[ -z "$screen_width" ] && screen_width=2560 -[ -z "$screen_height" ] && screen_height=1440 +## Default to 2k +screen_width=${screen_width:-2560} +screen_height=${screen_height:-1440} # $HOME/.config/wallpaper-chooser/config.json: # ```json @@ -71,37 +73,43 @@ touch "$image" 2>/dev/null || true # ignore errors # Copy image to local wallpaper directory +## Format of current and cached wallpaper wallpaper_ext="png" +## Generate a random name for the current wallpaper +set +o pipefail # SIGPIPE is expected here random_name=$(tr -dc 'a-zA-Z0-9' /dev/null 2>/dev/null + fi + notify-send -a "change-wallpaper" "Blurred Wallpaper Applied" "$blurred_image" -i "$blurred_image" + } + ### Check if cached blurred image exists if [ -f "$blurred_cache_image" ]; then # sleep 1 # Some ugly workaround @@ -116,11 +132,7 @@ blurred_cache_image="$blur_cache_dir/${hash}.${wallpaper_ext}" echo "Could not copy cached blurred image" # exit 1 # Non-critical error else - find "$blur_dir" -type f -name "blurred-*" ! -name "$(basename "$blurred_image")" -delete - if [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then - swww img -n backdrop "$blurred_image" --transition-type fade --transition-duration 2 >/dev/null 2>/dev/null - fi - notify-send -a "change-wallpaper" "Blurred Wallpaper From Cache" "$blurred_image" -i "$blurred_image" + apply_blured exit 0 fi fi @@ -133,7 +145,7 @@ blurred_cache_image="$blur_cache_dir/${hash}.${wallpaper_ext}" printf "%.2f", s }') - ### use a temporary file to avoid incomplete file being used + ### Batch processing using a temporary file to avoid incomplete file being used temp_blurred=$(mktemp --suffix=."$wallpaper_ext") || exit 1 trap 'rm -f "${temp_blurred}"' EXIT magick "$wallpaper_image" -blur 0x"$sigma" "$temp_blurred" || { @@ -146,18 +158,12 @@ blurred_cache_image="$blur_cache_dir/${hash}.${wallpaper_ext}" exit 1 } - find "$blur_dir" -type f -name "blurred-*" ! -name "$(basename "$blurred_image")" -delete - cp -f "$blurred_image" "$blurred_cache_image" || { echo "Could not cache blurred image" # exit 1 # Non-critical error } - if [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then - swww img -n backdrop "$blurred_image" --transition-type fade --transition-duration 2 >/dev/null 2>/dev/null - fi - - notify-send -a "change-wallpaper" "Blurred Wallpaper Generated" "$blurred_image" -i "$blurred_image" + apply_blured ) & # Apply wallpaper diff --git a/config/wallpaper/Pictures/backgrounds b/config/wallpaper/Pictures/backgrounds index abde275..2382384 160000 --- a/config/wallpaper/Pictures/backgrounds +++ b/config/wallpaper/Pictures/backgrounds @@ -1 +1 @@ -Subproject commit abde27520954d600857b787e68aa3850c2273efa +Subproject commit 2382384128f6d5a5fc325be34a5122b0defa9261 diff --git a/memo/mail-service.md b/memo/mail-service.md index 2afb630..bbda481 100644 --- a/memo/mail-service.md +++ b/memo/mail-service.md @@ -73,9 +73,10 @@ | 简写 | 全称 | 中文名称 | 说明 | | --------------- | --------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------- | | rDNS | Reverse DNS | 反向域名解析 | 将 IP 地址映射回域名的特殊 DNS 记录. 多个 ip 可以同时映射到同一个域名, 但一个 ip 只能映射到一个域名. | + | PTR | Pointer Record | 指针记录 | rDNS 使用的 DNS 记录类型. | | SPF | Sender Policy Framework | 发件人策略框架 | 用于防止伪造发件人的技术. | | DKIM | DomainKeys Identified Mail | 域名密钥识别邮件 | 用于验证邮件的完整性和真实性的技术. | - | DMARC | Domain-based Message Authentication, Reporting, and Conformance | 基于域的消息认证, 报告和一致性 | 用于指定邮件在目标服务的处理策略. | + | DMARC | Domain-based Message Authentication, Reporting, and Conformance | 基于域的消息认证, 报告和一致性 | 用于指定邮件在目标服务器的处理策略. | | DMARC Alignment | DMARC Alignment | DMARC 对齐 | 用于确保发件人域名与 SPF 和 DKIM 认证域名一致的策略. | | MTA-STS | Mail Transfer Agent Strict Transport Security | 邮件传输代理严格传输安全 | 用于防止中间人攻击的技术. | | TLS-RPT | Transport Layer Security Reporting | 传输层安全报告 | 一方向另一方反馈 TLS 相关报告的方式. | @@ -84,13 +85,13 @@ - 邮件数据 - | 名称 | 中文名称 | 说明 | - | ------------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | Envelope From | 信封发件人 | 邮件传输过程中使用的发件人地址. 通常在接受到的邮件头部中以 `Return-Path` 字段显示. | - | Header From / From | 邮件头部发件人 | 邮件头部中显示的发件人地址, 也是在邮件客户端中能清晰看到的最醒目的发件人地址. | - | Return-Path | 退信路径 | 邮件头部中的一个字段, 用于指定邮件的回执地址, 通常由接受方 MTA 根据 Envelope sender 生成. | - | DKIM-Signature | DKIM 签名 | 邮件头部中的一个字段, 包含用于验证邮件完整性和真实性的签名信息. | - | Content-Type | 内容类型 | 邮件头部中的一个字段, 用于指定邮件内容的格式和编码方式. 文本为主的邮件通常使用 `text/plain; charset="UTF-8"` 或 `text/html; charset="UTF-8"`, 二者在收件方的垃圾邮件过滤策略中可能会有不同的检测标准和权重. | + | 名称 | 中文名称 | 说明 | + | -------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | Envelope From | 信封发件人 | 邮件传输过程中使用的发件人地址. 通常在接受到的邮件头部中以 `Return-Path` 字段显示. | + | (Header) From | 邮件头部发件人 | 邮件中显示的发件人地址, 也是在邮件客户端中能清晰看到的最醒目的发件人地址. | + | Return-Path | 退信路径 | 邮件头部中的一个字段, 用于指定邮件的回执地址, 通常由接受方 MTA 根据 Envelope sender 生成. | + | DKIM-Signature | DKIM 签名 | 邮件头部中的一个字段, 包含用于验证邮件完整性和真实性的签名信息. | + | Content-Type | 内容类型 | 邮件头部中的一个字段, 用于指定邮件内容的格式和编码方式. 文本为主的邮件通常使用 `text/plain; charset="UTF-8"` 或 `text/html; charset="UTF-8"`, 二者在收件方的垃圾邮件过滤策略中可能会有不同的检测标准和权重. | - 反垃圾与声誉 @@ -311,9 +312,9 @@ services: ports: - '25:25' # SMTP - '143:143' # IMAP + - '993:993' # IMAPS - '587:587' # STARTTLS - '465:465' # SMTPS - - '993:993' # IMAPS - '127.0.0.1:11334:11334' # Raspamd Web UI environment: - DMS_DEBUG=0