<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>jutty.dev - wayland</title>
    <subtitle>Computer nerd memory leaks</subtitle>
    <link rel="self" type="application/atom+xml" href="https://blog.jutty.dev/tags/wayland/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://blog.jutty.dev"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2025-05-28T19:29:14-03:00</updated>
    <id>https://blog.jutty.dev/tags/wayland/atom.xml</id>
    <entry xml:lang="en">
        <title>Waypipe: graphical remote access for Wayland applications</title>
        <published>2025-05-28T19:29:14-03:00</published>
        <updated>2025-05-28T19:29:14-03:00</updated>
        
        <author>
          <name>
            
              Juno Takano
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://blog.jutty.dev/notes/waypipe/"/>
        <id>https://blog.jutty.dev/notes/waypipe/</id>
        
        <content type="html" xml:base="https://blog.jutty.dev/notes/waypipe/">&lt;p&gt;Tried out &lt;a class=&quot;out-link&quot; rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gitlab.freedesktop.org&#x2F;mstoeckl&#x2F;waypipe&quot;&gt;Waypipe&lt;&#x2F;a&gt; today as a way to remotely control graphical Wayland applications between Alpine Linux and FreeBSD hosts and it’s snappy on my wireless network + decade-old hardware combo!&lt;&#x2F;p&gt;
&lt;p&gt;At first, the minimal example given by Waypipe in its README and man page did not work:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;waypipe&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ssh user@server foot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;small&gt;&lt;em&gt;(I’m using &lt;a class=&quot;out-link&quot; rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;codeberg.org&#x2F;dnkl&#x2F;foot&quot;&gt;foot&lt;&#x2F;a&gt; as the example here because that’s the terminal I use on both systems, but it could be anything — a simplistic application, a web browser or even a full-blown compositor).&lt;&#x2F;em&gt;&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This failed with the following message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;S2874:  0.603209 [src&#x2F;server.c:649] Env. var XDG_RUNTIME_DIR not available, cannot place display socket for WAYLAND_DISPLAY=&amp;quot;wayland-HBTrV7VT&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The issue here is that most (all?) Wayland applications expect at least &lt;code&gt;XDG_RUNTIME_DIR&lt;&#x2F;code&gt; to be set, and a bare ssh connection will not set that on its own.&lt;&#x2F;p&gt;
&lt;p&gt;The man page does mention this and how to fix it. It gives you several options, one of which is using &lt;code&gt;~&#x2F;.ssh&#x2F;environment&lt;&#x2F;code&gt; and setting it up properly at the &lt;a class=&quot;out-link&quot; rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man.openbsd.org&#x2F;ssh#USER&quot;&gt;client&lt;&#x2F;a&gt; and &lt;a class=&quot;out-link&quot; rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;man.openbsd.org&#x2F;sshd_config.5#PermitUserEnvironment&quot;&gt;server&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, I prefer to use the following approach because it’s isolated to each host instead:&lt;&#x2F;p&gt;
&lt;p&gt;Client &lt;code&gt;~&#x2F;.ssh&#x2F;config&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host &amp;lt;server&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    User &amp;lt;user&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SetEnv XDG_RUNTIME_DIR=&amp;lt;user-writable-directory&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The directory above must exist prior to the connection and must be writable by the user as whom we will ssh into the server. Otherwise, it will throw the following error:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;S2889: 60.436704 [src&#x2F;util.c:237] Error opening folder in which to connect to socket: Permission denied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If you’d rather reuse the &lt;code&gt;XDG_RUNTIME_DIR&lt;&#x2F;code&gt; value you already have set on the client, you can also use &lt;code&gt;SendEnv&lt;&#x2F;code&gt; instead of &lt;code&gt;SetEnv&lt;&#x2F;code&gt;, but their values may not be interchangeable. In my case, Alpine and FreeBSD use different directories with different permissions. This is one other advantage of this method over &lt;code&gt;~&#x2F;.ssh&#x2F;environment&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Next, you need to make sure the server will allow the client to send this environment variable.&lt;&#x2F;p&gt;
&lt;p&gt;Server &lt;code&gt;&#x2F;etc&#x2F;ssh&#x2F;sshd_config&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AcceptEnv XDG_RUNTIME_DIR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Make sure you have Waypipe installed on both server and client. Finally, from the client’s shell:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;waypipe&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ssh user@server foot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That’s it! If all went well, a window should pop up with &lt;code&gt;foot&lt;&#x2F;code&gt; — or whatever command you chose — running directly from the server.&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
