By letting $t=x/2$, we have that
$$\int_{1/n}^{n}\cos(x/2)\frac{\ln (x)}{x}dx=\int_{1/(2n)}^{n/2}\cos(t)\frac{\ln(t) +\ln(2)}{t}dt$$
Hence
$$\begin{align}\int_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln(x)}{x}\,dx&=
\int_{n/2}^{n}\frac{\cos(x)}{x}\ln(x)dx-\int_{1/(2n)}^{1/n}\frac{\cos(x)}{x}\ln(x)\,dx \\
&\qquad-\ln(2)\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}\,dx.\end{align}$$
Now show that
$$\begin{align}
&\lim_{n\to \infty}\int_{n/2}^{n}\frac{\cos(x)}{x}\ln(x)\,dx=0,\\
&\lim_{n\to \infty}\int_{1/(2n)}^{1/n}\frac{\cos(x)-1}{x}\ln(x)\,dx=0.
\end{align}$$
Morever
$$\lim_{n\to \infty}\left(\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}\,dx-\ln(n)\right)
=\lim_{n\to \infty} (-\text{Ci}(\frac{1}{2n})-\ln(n))=\ln(2)-\gamma.$$
where $\text{Ci}(x)$ is the cosine integral (recall that
$\text{Ci}(x)=\ln(x)+\gamma+o(1)$, as $x\to 0$).
Therefore
$$\int_{1/(2n)}^{n/2}\frac{\cos(x)}{x}dx=\ln(n)+\ln(2)-\gamma+o(1),$$
and
$$\int_{1/(2n)}^{1/n}\frac{\cos(x)}{x}\ln(x)\,dx
=-\ln(2)\ln(n)-\frac{\ln^2(2)}{2}+o(1).$$
Thus we may conclude that
$$\lim_{n \to \infty}\int_{1/n}^{n}\left(\cos x-\cos(x/2)\right)\frac{\ln (x)}{x} \, dx=\boxed{\gamma \ln (2)-\frac{\ln^2(2)}{2}}.$$
I will concentrate on this part of your proof, the calculation of this integral (the other steps of your proof are correct):
$$\int_{0}^{\infty} \frac{\Big|\sin\left(x+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(x-\frac{\pi}{4}\right)\Big|}{x} dx$$
We will make use of the Lobachevsky integral formula:
Let $f(x)$ a $\pi$-periodic function (continous or integrable over its period). with
$\displaystyle f(x+\pi) = f(x)$ and $f(\pi-x) = f(x)$, for $0\leq x <\infty$. Then
$\displaystyle \int_{0}^{\infty} \frac{\sin x}{x} f(x) dx = \int_{0}^{\frac{\pi}{2}} f(x) dx. $
Now, for your integral:
If you make the change of variable $\displaystyle x=\frac{w}{2}$
$\displaystyle I=\int_{0}^{\infty} \frac{\Big|\sin\left(x+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(x-\frac{\pi}{4}\right)\Big|}{x} dx = \int_{0}^{\infty} \frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{w} dw $
Multiplying and dividing by $\sin w$:
$$I= \int_{0}^{\infty} \frac{\sin w}{w} \frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{\sin w} dw$$
The function
$$f(w) = \frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{\sin w}$$
is $\pi$-periodic
By the Lobachevsky integral formula:
$$\displaystyle I=\int_{0}^{\infty} \frac{\sin w}{w} \frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{\sin w} dw = \int_{0}^{\frac{\pi}{2}}\frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{\sin w}dw $$
Note that for $w\in\left(0,\frac{\pi}{2}\right)$
$$\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big|= \sin\left(\frac{w}{2}+\frac{\pi}{4}\right)$$
$$\Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|= -\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)$$
Hence
$$\displaystyle\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big| = \sqrt{2}\sin\left(\frac{w}{2}\right)\displaystyle $$
Therefore
$$ I = \int_{0}^{\frac{\pi}{2}}\frac{\Big|\sin\left(\frac{w}{2}+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(\frac{w}{2}-\frac{\pi}{4}\right)\Big|}{\sin w}dw = \sqrt{2}\int_{0}^{\frac{\pi}{2}}\frac{\sin\left(\frac{w}{2}\right)}{\sin w}dw$$
Using $\displaystyle \frac{\sin\left(\frac{w}{2}\right)}{\sin w} = \frac{1}{2}\sec\left(\frac{w}{2}\right)$
we have
$$I = \sqrt{2}\int_{0}^{\frac{\pi}{2}}\frac{\sin\left(\frac{w}{2}\right)}{\sin w}dw = \frac{\sqrt{2}}{2}\int_{0}^{\frac{\pi}{2}} \sec\left(\frac{w}{2} \right)dw = \sqrt{2} \operatorname{arctanh}\left(\frac{1}{\sqrt{2}}\right)$$
We can conclude
$$\boxed{\int_{0}^{\infty} \frac{\Big|\sin\left(x+\frac{\pi}{4}\right)\Big| - \Big|\sin\left(x-\frac{\pi}{4}\right)\Big|}{x} dx = \sqrt{2} \operatorname{arctanh}\left(\frac{1}{\sqrt{2}}\right)}$$
Therefore
$$\boxed{\int_{-\infty}^0 \max\left(\frac{\cos(x)}{x},\frac{\sin(x)}{x}\right)dx+ \int_0^\infty \min\left(\frac{\cos(x)}{x},\frac{\sin(x)}{x}\right)dx = \frac{\pi}{2} +\operatorname{arctanh}\left(\frac{1}{\sqrt{2}}\right)} $$
Some numerical approximations from Wolfram:
The sum is 2.44206
while
$$\frac{\pi}{2} + \operatorname{arctanh}\left(\frac{1}{\sqrt{2}}\right)\approx 2.45216..$$
Best Answer
For almost any choice of $x\in \mathbb{R}$, the set $$ \{\cos(nx) : n\in \mathbb{N} \}$$ is dense $[-1,1]$. Most books on ergodic theory likely have a proof of this fact, and it looks like there is already a proof on Math SE, so I will take this as given.
Note that $$ f(x) := 1+\lim_{n\to\infty} \min_{k\in\{1,2,\dotsc,n\}} \{ \cos(kx) \}. $$ Since $\{\cos(nx)\}$ is dense in $[-1,1]$ for almost every $x$, it follows that $f(x) = 0$ almost everywhere. To see this, note that if $x$ is such that $\{\cos(nx)\}$ is dense, then for any $\varepsilon > 0$, there is an $N$ such that $\cos(Nx) \in [-1,-1+\varepsilon)$. But then $$ f(x) = 1 + \cos(Nx) < 1 + (-1+\varepsilon) = \varepsilon. $$ This holds for any $\varepsilon > 0$, hence $f(x) = 0$ for any $x$ with $\{\cos(nx)\}$ dense (which is, again, almost every $x$).
If a function is zero almost everywhere, then it integrates to zero. Therefore $$ \int_{-\pi}^{\pi} f(x) \,\mathrm{d}x = \int_{-\pi}^\pi1+\lim\limits_{n\to\infty}\min(\cos(x),\dotsc,\cos(nx))\,\mathrm{d}x = 0.$$ A nearly identical argument applies to the other integral.