Bug#614127: confirmed on allmachines: painfull
On Fri, Feb 25, 2011 at 14:05:07 +0100, Samuel Thibault wrote:
> Otavio Salvador, le Fri 25 Feb 2011 13:01:59 +0000, a écrit :
> > if pidof X > /dev/null; then
> > echo "X is running"
> > else
> > echo "X isn't running"
> > fi
>
> Errr, surely not :)
>
> What Anton wants is to know whether X is currently at the front or not.
> And you can't rely on DISPLAY being set (since you could be from sudo su
> -), and you can't rely on stdin being the VT (since you could be from
> screen). At best you could test whether the console is in text or
> graphical mode.
>
Why "at best"? It sounds like checking whether the active VT is in
KD_TEXT is exactly what's needed here.
Cheers,
Julien
Reply to: