From f0ae8e44eb9b2c5fe3f555643a77ac45d5856e75 Mon Sep 17 00:00:00 2001
From: Gloria Mundi <gloria@gloria-mundi.eu>
Date: Tue, 27 Feb 2024 14:55:04 +0100
Subject: add source file names to listings

---
 latexHeaders/code.sty | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'latexHeaders/code.sty')

diff --git a/latexHeaders/code.sty b/latexHeaders/code.sty
index 987f43d..af7f817 100644
--- a/latexHeaders/code.sty
+++ b/latexHeaders/code.sty
@@ -118,6 +118,18 @@
 	}
 }
 
+\lst@AddToHook{DeInit}{%
+	\ifthenelse{\equal{\lst@name}{}}{}{%
+		\begin{minipage}[b][0pt]{\linewidth}%
+			\vspace{0pt}%
+			\hfill%
+			\begin{ocg}[printocg=never]{Source file names}{srcfiles}{0}%
+				\hfill\textcolor{gray}{\lst@name}%
+			\end{ocg}%
+		\end{minipage}%
+	}%
+}
+
 \newenvironment{btHighlight}[1][]
 {\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
 {\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup}
-- 
cgit v1.2.3

