From aa8ba9b574106b8bb6d0ef422bd8ee88bba1f1e3 Mon Sep 17 00:00:00 2001 From: Ali Yahya Date: Mon, 24 Jun 2024 13:27:51 -0400 Subject: [PATCH 1/2] Remove non-printable ASCII characters from yabai query. Signed-off-by: Ali Yahya --- lib/scripts/init.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/scripts/init.sh b/lib/scripts/init.sh index b44ee2f2..f1ffe7c0 100644 --- a/lib/scripts/init.sh +++ b/lib/scripts/init.sh @@ -79,4 +79,8 @@ echo $(cat <<-EOF "skhdMode": $skhd_mode } EOF -) | tr -d '\n' # removes newlines from output (handling Google Chrome JSON parse error caused by "search in page") +) | \ + # removes non-printable ASCII characters, https://alvinalexander.com/blog/post/linux-unix/how-remove-non-printable-ascii-characters-file-unix/ + tr -cd '\11\12\15\40-\176' | \ + # removes newlines from output (handling Google Chrome JSON parse error caused by "search in page") + tr -d '\n' From 8163c045320e8357ee02ddf1216920374d9be931 Mon Sep 17 00:00:00 2001 From: Ali Yahya Date: Mon, 24 Jun 2024 13:56:32 -0400 Subject: [PATCH 2/2] Only remove invisible U+200E unicode character. Signed-off-by: Ali Yahya --- lib/scripts/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/scripts/init.sh b/lib/scripts/init.sh index f1ffe7c0..fd35facc 100644 --- a/lib/scripts/init.sh +++ b/lib/scripts/init.sh @@ -80,7 +80,7 @@ echo $(cat <<-EOF } EOF ) | \ - # removes non-printable ASCII characters, https://alvinalexander.com/blog/post/linux-unix/how-remove-non-printable-ascii-characters-file-unix/ - tr -cd '\11\12\15\40-\176' | \ + # removes invisible U+200E Left-To-Right Mark character + sed "s/\xe2\x80\x8e//g" | \ # removes newlines from output (handling Google Chrome JSON parse error caused by "search in page") tr -d '\n'