Files
bin/clip-sanitizer.sh
T
Kryštof Pešek ae8c452fb5 feat(fleet): add fleet-beacon with penguin support and remote targets
# Conflicts:
#	fleet-beacon
#	fleet-beacon~f062955 (feat(fleet): add fleet-beacon with penguin support and remote targets)
2026-11-05 16:40:09 +01:00

18 lines
599 B
Bash
Executable File

#!/usr/bin/env bash
while clipnotify; do
# Grab what was just copied
current_content=$(xclip -selection clipboard -o 2>/dev/null)
if [[ -n "$current_content" ]]; then
# Nuke NBSP (c2 a0) and ZWSP (e2 80 8b)
sanitized=$(echo -n "$current_content" | sed 's/\xc2\xa0/ /g; s/\xe2\x80\x8b//g')
# Guard: Only write back if a cheesy space was actually destroyed
# This prevents an infinite event loop
if [[ "$current_content" != "$sanitized" ]]; then
echo -n "$sanitized" | xclip -selection clipboard -i
fi
fi
done