From 9273d021a5c5f4ef767a349996aa6bf318054d8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?=
 <yps@yaroslavps.com>
Date: Fri, 7 Jun 2024 02:04:57 +0300
Subject: scope: force sixel for previews on Alacritty

---
 dotfiles/.local/bin/scope | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'dotfiles/.local/bin/scope')

diff --git a/dotfiles/.local/bin/scope b/dotfiles/.local/bin/scope
index 46b01a9..f094601 100755
--- a/dotfiles/.local/bin/scope
+++ b/dotfiles/.local/bin/scope
@@ -33,7 +33,12 @@ HIGHLIGHT_STYLE='pablo'
 
 handle_img() {
 	if [ -n "$w" -a -n "$h" ]; then
-		chafa --polite on --animate off -s "${w}x${h}" $FILE_PATH | sed 's/#/\n#/g'
+		# A little hack to force sixel on ayosec's Alacritty fork
+		if [ "$TERM" = alacritty ]; then
+			chafa --polite on --animate off -f sixel -s "${w}x${h}" $FILE_PATH | sed 's/#/\n#/g'
+		else
+			chafa --polite on --animate off -s "${w}x${h}" $FILE_PATH | sed 's/#/\n#/g'
+		fi
 	else
 		exiftool "${FILE_PATH}"
 	fi
-- 
cgit v1.2.3