On Mon, 3 Jul 2023 12:41:25 +0300 Riza Dindir <riza.din...@gmail.com> said:

> Hello,
> 
> I thought that it will set the background color, and this will be it.

It does. but to do ANYTHING in X as a client you have to connect first, then do
your thing (set background) then as you exit as a process you will disconnect
(or you can explicitly close the connection too). nothing gets done without
connecting first.

> I added an xterm in there like so (this is in a file run.sh and I am
> running this shell script with (DISPLAY=:1 sh run.sh)
> 
> xsetroot -solid "#006060"
> xterm -geometry +20+40

tjhat's serial.

xsetroot - connect
xsetroot - set bg color
xsetroot - disconnect
... xserver reset
xterm - connect
xterm - create/map window
xterm - sit in loop listening to events...

> With this the background color turns to a blue then the background
> goes black. But the xterm is seen, and if I exit xterm, the session
> ends.
> 
> But if I do this (notice the ampersand at the end of the xsetroot line)
> 
> xsetroot -solid "#006060" &
> xterm -geometry +20+40
> 
> the background color stays, and is not changed to black as it is the
> case with the above example.

race condition. it works by luck there - that x manages to connect before
xsetroot disconnects.

> Regards,
> Riza
> 
> On Mon, Jul 3, 2023 at 11:39 AM Carsten Haitzler <ras...@rasterman.com> wrote:
> >
> > On Sat, 1 Jul 2023 13:08:54 +0300 Riza Dindir <riza.din...@gmail.com> said:
> >
> > > Hello All,
> > >
> > > I want to use Xephyr to test out an x application.
> > >
> > > For starters I wanted to learn how to use Xephyr. Here is what I did.
> > >
> > > I started xephyr on display 1 like so (Xephyr :1 -screen 800x600). The
> > > window opened where the background is black. Then ran (DISPLAY=:1
> > > xsetroot -solid white) to change the background color. But when I set
> > > the background to white, the background does not stay white. It
> > > changes to black within 1 second.
> > >
> > > Is this default behavior? Why can't I set the background color on a
> > > Xephyr window?
> >
> > because xsetroot is the only x client. it connects, sets root window bg
> > color to white, then disconnects. now the xserver has zero clients left. it
> > resets itself as from it's point of view the session ended. you can either
> > ensure another client is always running (almost all the time this is a
> > window manager at a minimum) until the session ends, or you can try the
> > -noreset option to Xephyr
> >
> > --
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> > Carsten Haitzler - ras...@rasterman.com
> >
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - ras...@rasterman.com

Reply via email to