<div dir="ltr">What do you see if you run weston on tty3 (rather than sway), without setting WAYLAND_SOCKET or --socket?</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 21, 2017 at 12:02 AM, Dima Ryazanov <span dir="ltr"><<a href="mailto:dima@gmail.com" target="_blank">dima@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>1. Actually, Weston *should* set the right wayland socket automatically. They're not mapped to ttys - but Weston tries them until it finds an available one (at least, in my case). I see the following in the log:</div><div><div><br></div><div>[23:52:27.077] libwayland: unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor is running</div></div><div><br></div><div>So to me, this looks like a bug in sway.</div><div><br></div><div>2. Setting "<span style="font-size:12.8px">WAYLAND_DISPLAY=wayland-1" before running Weston causes Weston to try to connect to a parent compositor instead of running directly on top of the tty. But of course, there's no parent compositor listening on wayland-1.</span></div><div><span style="font-size:12.8px">Yeah, setting --socket=wayland-1 should work - but, as I said above, shouldn't actually be necessary.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">3. gnome-terminal works for me as expected, despite the server process. I'm not really familiar with it, though.</span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 20, 2017 at 9:58 PM, Matt Hoosier <span dir="ltr"><<a href="mailto:matt.hoosier@gmail.com" target="_blank">matt.hoosier@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Deepak,<br>
<span><br>
On Fri, Oct 20, 2017 at 11:50 AM, Deepak Jois <<a href="mailto:deepak.jois@gmail.com" target="_blank">deepak.jois@gmail.com</a>> wrote:<br>
> Hi<br>
><br>
> I have read the Wayland docs and skimmed through the API reference,<br>
> and I am trying to understand some concepts better. The questions<br>
> below are probably a bit naive, but I appreciate any<br>
> suggestions/explanations.<br>
><br>
> To illustrate my situation better, let me start with an actual<br>
> scenario I tried to make work. I am trying to run Gnome and another<br>
> Wayland-based window manager (Sway or Weston) in two different ttys as<br>
> the same user.<br>
><br>
> I have Gnome running under Wayland on tty2. The Gnome session is<br>
> running some app like gnome-terminal.<br>
><br>
> I do the following:<br>
><br>
> * Press Ctrl-Alt-F3 (switching to tty3, the lowest free tty)<br>
> * Login as the same user running the Gnome session<br>
> * Launch sway<br>
> * Launch urxvt and try to launch gnome-terminal.<br>
><br>
> Now I have two issues I am trying to understand better:<br>
><br>
> 1. When I check the WAYLAND_DISPLAY variable in the sway session, it<br>
> shows 'wayland-0', which is the same as the one show in the Gnome<br>
> session. Why is it the same? Does Wayland have a concept of multiple<br>
> servers/sessions per user? Can I run the Gnome session and the Sway<br>
> session separately?<br>
<br>
</span>Although you're right that the goal here is to bind the different<br>
Wayland sessions' values for WAYLAND_DISPLAY to unique virtual<br>
terminals, that won't happen automatically just because you launched<br>
them from separate tty's.<br>
<br>
The trick here is to inform each compositor that it should be<br>
listening on a different Wayland socket name. For example, if you use<br>
Weston:<br>
<br>
    $ weston --socket=wayland-1<br>
<br>
This will cause Weston to establish its listening socket under the<br>
name /run/user/<uid>/wayland-1 rather than the default<br>
/run/user/<uid>/wayland-0. I think you're running into collisions<br>
where each of your compositor instances is mislead into believing that<br>
it successfully managed to appropriate /run/user/<uid>/wayland-0 for<br>
itself.<br>
<br>
Also (at least for Weston), the value of the '--socket' parameter is<br>
used to automatically compute and set the value of the<br>
$WAYLAND_DISPLAY environment variable which is then passed along to<br>
all children of the compositor. Presumably for you, your desktop<br>
environment (e.g., Weston's desktop-shell) is the starting point from<br>
which you're launching other graphical programs. They will all in turn<br>
inherit this correct value of $WAYLAND_DISPLAY too.<br>
<span><br>
><br>
> 2. I tried explicitly setting the WAYLAND_DISPLAY to wayland-1. It has<br>
> no effect on Sway. The WAYLAND_DISPLAY variable is reset inside the<br>
> session to wayland-0. But when I try to launch Weston, it errors out<br>
> (log below). Is this expected, or is this a bug?<br>
<br>
</span>The way to get Weston to pass the right value of WAYLAND_DISPLAY to<br>
its spawn is to use --socket=.<br>
<br>
It's more difficult to invoke the Wayland gnome-session directly. I'm<br>
not sure how you would micromanage its selection of the server socket<br>
name.<br>
<span class="m_-3591166747763639030HOEnZb"><font color="#888888"><br>
-Matt<br>
</font></span><div class="m_-3591166747763639030HOEnZb"><div class="m_-3591166747763639030h5">______________________________<wbr>_________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.freedeskto<wbr>p.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>