Is it possible to achieve the same with KOMAscript and scrlayer-scrpage, for both the even pages with the chapter title and the odd pages with the section title?

Unlike the linked example I'd like to get:

even page:

chapter title _________________________________________________

odd page:

__________________________________ section number section title

Page numbers are not relevant, as they are in the footer.

Here a MWE to play with:

\documentclass{scrbook}

\renewcommand*{\chaptermarkformat}{\scshape}

\usepackage{blindtext}

\begin{document}

\chapter{Hello World!}
\section{Section One}
\blindmathpaper
\blindmathpaper
\blindmathpaper

\end{document}


I tried to abolish the headsepline and modify the \chaptermarkformat and \sectionmarkformat using hrulefill, which seems to be a good way. But I can't get it right.

\documentclass{scrbook}

\RequirePackage[automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}[1]{\scshape \hspace{2ex} \hrulefill}


(chapter name should be on left side, spacing wrong)

With

\renewcommand*{\sectionmarkformat}[1]{\hrulefill \hspace{2ex} \thesection \hspace{1ex} \rightmark }


the odd page looks all right, but it seems to me that it should be done a little different. E.g. why do I need set the spacing manually here: \thesection \hspace{1ex} \rightmark

Here is a suggestion using \hrulefill

\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}{}

\usepackage{blindtext}

\begin{document}
\Blinddocument
\end{document}


Or if you want to use the headmarks=.1pt option:

\documentclass{scrbook}
\usepackage{xcolor}

\DeclareNewLayer[
\DeclareNewLayer[
evenpage


• Thanks for your extensive answer! Regarding your additional edit: I finally used this two commands: \def\verrulefill{\leaders\hrule width 0pt height 3pt depth -2.8pt \hfill}% \newcommand{\headseprule}{{\color[rgb]{0.75,0.75,0.75}\verrulefill}} to modify thickness, color and vertical position of the line. Seems a little easier. Or what else is the purpose of the large second part of your answer? – thewaywewalk Apr 19 '15 at 20:00