<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Webapps on Janusworx</title>
    <link>https://janusworx.com/tags/webapps/</link>
    <description>Recent content in Webapps on Janusworx</description>
    <image>
      <title>Janusworx</title>
      <url>https://janusworx.com/images/jw-logo.png</url>
      <link>https://janusworx.com/images/jw-logo.png</link>
    </image>
    <generator>Hugo -- 0.162.1</generator>
    <language>en</language>
    <lastBuildDate>Fri, 17 Nov 2023 19:09:46 +0530</lastBuildDate>
    <atom:link href="https://janusworx.com/tags/webapps/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Getting Around Linux Mint Web App Manager Window Errors</title>
      <link>https://janusworx.com/work/getting-around-linux-mint-web-app-manager-window-errors/</link>
      <pubDate>Fri, 17 Nov 2023 19:09:46 +0530</pubDate>
      <guid>https://janusworx.com/work/getting-around-linux-mint-web-app-manager-window-errors/</guid>
      <description>&lt;p&gt;One of best parts of using Linux Mint is its &lt;a href=&#34;https://www.linuxmint.com/rel_ulyssa_cinnamon_whatsnew.php&#34;&gt;Web Apps Manager&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I can use most of my websites as dedicated applications now.&lt;br&gt;
Case in point, I use a dedicated web app to run &lt;a href=&#34;https://elk.zone/&#34;&gt;Elk&lt;/a&gt;, the web client for Mastodon.&lt;br&gt;
Social stuff like this, or banking stuff or my webmail for that matter, stays away from the rest of my browsing and lets me keep these activities cognitively separate.&lt;/p&gt;
&lt;p&gt;&lt;hr style=&#39;margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;&#39;/&gt;

&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;https://janusworx.com/images/2023/ff-err-1.png#center&#34;/&gt; 
&lt;/figure&gt;
&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>One of best parts of using Linux Mint is its <a href="https://www.linuxmint.com/rel_ulyssa_cinnamon_whatsnew.php">Web Apps Manager</a>.</p>
<p>I can use most of my websites as dedicated applications now.<br>
Case in point, I use a dedicated web app to run <a href="https://elk.zone/">Elk</a>, the web client for Mastodon.<br>
Social stuff like this, or banking stuff or my webmail for that matter, stays away from the rest of my browsing and lets me keep these activities cognitively separate.</p>
<p><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<figure class="align-center ">
    <img loading="lazy" src="/images/2023/ff-err-1.png#center"/> 
</figure>
</p>
<hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<p>So far, so good.<br>
The issue arises, when I try to launch one of these dedicated apps and it is already running.<br>
Due to the way these little web containers are created, it cannot run another instance and I run into this error.<br>
<br>
</p>
<blockquote>
<p><em>“Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.”<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></em></p>
</blockquote>
<p><br>

<figure class="align-center ">
    <img loading="lazy" src="/images/2023/ff-err-2.png#center"/> 
</figure>

<br>

And I’m like, I know this you git! I <em>am</em> running a different profile. Can’t you just switch to it? Apparently it cannot. So I’d have to go looking for my app and then <em>Alt-Tab</em> through dozens of windows or look in my dock<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup> and then get it back.</p>
<hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<p>The problem wasn’t the error per se, the problem was the slightly longish delay between me calling the app and the error popping up. And also all that crazy hunting and pecking to find the right window, once I see the error. It gets maddening when I need to do this dance and all I want to do is get to my email window to go look for something important.</p>
<p>So I began casting around for a way to somehow switch to the actually running window. Was it possible?<br>
That’s when I found <a href="https://github.com/jordansissel/xdotool"><code>xdotool</code></a><br>
It lets you do all sorts of crazy things with windows and keyboard and mouse input, but most importantly for me, it let me search for my running app window <em>and</em> it let me raise and bring it back up. Awesome!</p>
<p>So instead of telling <a href="https://ulauncher.io/">Ulauncher</a> to directly launch the app, I told it to run this script instead.</p>
<hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<figure class="align-center ">
    <img loading="lazy" src="/images/2023/ff-err-3.png#center"
         alt="pic of the ulauncher script window"/> 
</figure>

<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">8
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">9
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e">#!/usr/bin/env bash 
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>export ELKWINID<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>xdotool search WebApp-ElkforToots1234 | tail -n1<span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> $ELKWINID <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
</span></span><span style="display:flex;"><span>    xdotool windowactivate $ELKWINID
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">else</span>
</span></span><span style="display:flex;"><span>    sh -c <span style="color:#e6db74">&#39; firefox --class WebApp-ElkforToots1234 --profile /home/user/.local/share/ice/firefox/ElkforToots1234 --no-remote &#34;https://elk.zone/&#34;&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fi</span>
</span></span></code></pre></td></tr></table>
</div>
</div><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<p>In a nutshell, I’m looking to see if Elk is already running (using the xdotool search option in line 3).<br>
If it is, I tell xdotool to get that window to the forefront of the display; and if it isn’t, then to just go ahead and launch the app anew.</p>
<p>What a load off my mind, this one was!</p>
<p><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

Feedback on this post? Mail me at <a href="mailto:feedback@janusworx.com">feedback@janusworx.com</a>
<br>

<br>

P.S. Subscribe to my <a href="https://janusworx.com/subscribe/">mailing list!</a><br>
Forward these posts and letters to your friends and get them to subscribe!<br>
P.P.S. Feed my <a href="https://www.amazon.in/hz/wishlist/ls/2QAUKHHAMOOVS?ref_=wl_share">insatiable reading habit.</a></p>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>I don’t know if this would happen if I use Chrome as the browser engine. I don’t even use it as a browser, much. And for things like these, I wouldn’t touch it with a ten foot pole.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p>and still some how miss it&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
  </channel>
</rss>
