\documentclass{scrartcl}
\usepackage{libertinus-otf}
%StartVisiblePreamble
\usepackage{xindex}
\makeindex
%StopVisiblePreamble
\makeatletter
\let\ps@plain\ps@empty
\makeatother
\begin{document}
\index{foo}foo and
\writeidx{\item\protect\hrulefill}
\index{bar}bar
\index{gex}gex
\printindex
\end{document}
