From d111169e4e53cccd6fd095189c1b4cbce2ba4e3a Mon Sep 17 00:00:00 2001 From: aguil Date: Sat, 11 Jul 2026 13:56:38 -0600 Subject: [PATCH 1/2] fix(apt): restore lexicographic order in apt-packages.txt Sort imagemagick and libsixel-bin per the apt-mark export convention so maintenance sort -c passes (compliance-apt-packages-unsorted). --- linux/apt-packages.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/apt-packages.txt b/linux/apt-packages.txt index 8c35c23..b4cd319 100644 --- a/linux/apt-packages.txt +++ b/linux/apt-packages.txt @@ -34,8 +34,8 @@ grep gzip highlight hostname -imagemagick htop +imagemagick init inotify-tools iproute2 @@ -49,8 +49,8 @@ libdebconfclient0 libncurses-dev libodbc2 libopengl-dev -libssl-dev libsixel-bin +libssl-dev locales login mawk From daeaad87281a36cbd2da91bdbce137135c7280c9 Mon Sep 17 00:00:00 2001 From: aguil Date: Sat, 11 Jul 2026 13:57:07 -0600 Subject: [PATCH 2/2] perf(agent): avoid full clipboard fetch on wl-paste --list-types Probe Windows clipboard image presence without PNG encode/decode so agent MIME type polls stay cheap (performance-wl-paste-list-types-full-fetch). --- dot_local/bin/executable_wl-paste | 2 +- dot_local/bin/lib/clipboard-image.sh | 72 ++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/dot_local/bin/executable_wl-paste b/dot_local/bin/executable_wl-paste index 04dd337..79303f2 100644 --- a/dot_local/bin/executable_wl-paste +++ b/dot_local/bin/executable_wl-paste @@ -30,7 +30,7 @@ fi case "${1:-}" in --list-types) - if clipboard_image_has_image; then + if clipboard_image_windows_has_image; then printf 'image/png\n' fi if [ -n "$real_wl_paste" ]; then diff --git a/dot_local/bin/lib/clipboard-image.sh b/dot_local/bin/lib/clipboard-image.sh index 2427a61..9aea0c4 100644 --- a/dot_local/bin/lib/clipboard-image.sh +++ b/dot_local/bin/lib/clipboard-image.sh @@ -111,6 +111,73 @@ EOF [ -s "$dest" ] } +clipboard_image_windows_has_image() { + local powershell ps_script win_script status + powershell="$(clipboard_image_resolve_powershell)" || return 1 + command -v wslpath >/dev/null 2>&1 || return 1 + + ps_script="$(mktemp --suffix=.ps1)" + cat >"$ps_script" <<'EOF' +$ErrorActionPreference = 'Stop' +Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName System.Drawing + +function Get-ClipboardImage { + $img = [System.Windows.Forms.Clipboard]::GetImage() + if ($null -ne $img) { return $img } + + $obj = [System.Windows.Forms.Clipboard]::GetDataObject() + if ($null -eq $obj) { return $null } + + $formats = @( + 'PNG', + 'image/png', + [System.Windows.Forms.DataFormats]::Bitmap, + [System.Windows.Forms.DataFormats]::Dib, + 'DeviceIndependentBitmap' + ) + foreach ($fmt in $formats) { + if (-not $obj.GetDataPresent($fmt)) { continue } + $data = $obj.GetData($fmt) + if ($null -eq $data) { continue } + if ($data -is [System.Drawing.Image] -or $data -is [System.Drawing.Bitmap]) { + return $data + } + if ($data -is [byte[]] -and $data.Length -gt 0) { + $ms = New-Object System.IO.MemoryStream(,$data) + try { + return [System.Drawing.Image]::FromStream($ms) + } catch { + continue + } finally { + $ms.Dispose() + } + } + if ($data -is [System.IO.MemoryStream]) { + try { + return [System.Drawing.Image]::FromStream($data) + } catch { + continue + } + } + } + + return $null +} + +$img = Get-ClipboardImage +if ($null -eq $img) { exit 1 } +$img.Dispose() +exit 0 +EOF + + win_script="$(wslpath -w "$ps_script")" + "$powershell" -NoProfile -STA -ExecutionPolicy Bypass -File "$win_script" >/dev/null 2>&1 + status=$? + rm -f "$ps_script" + [ "$status" -eq 0 ] +} + clipboard_image_fetch_darwin_to_file() { local dest="$1" @@ -257,6 +324,11 @@ clipboard_image_emit_windows_as_mime() { } clipboard_image_has_image() { + if clipboard_image_wsl_bridge_available; then + clipboard_image_windows_has_image + return + fi + local tmp tmp="$(mktemp --suffix=.png)" if clipboard_image_fetch_to_file "$tmp"; then