<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>glow.li: Homescreen</title>
        <description>A blog by glow.</description>
        <link>https://glow.li/tags/homescreen.xml</link>
        <atom:link href="https://glow.li/tags/homescreen.xml" rel="self" type="application/rss+xml"/>
        <generator>Glow.li Builder</generator>
            <item>
        <title>Display output of a bash script on a widget</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/termuxwidget1-big.webp?chash=Iebu876e0f"&gt;&lt;img src="https://glow.li/media/images/termuxwidget1.webp?chash=Iebu832750" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget1.webp?chash=Iebu832750 1500w, https://glow.li/media/images/1200/termuxwidget1.webp?chash=Iebu8faa7b 1200w, https://glow.li/media/images/1000/termuxwidget1.webp?chash=Iebu8faa7b 1000w, https://glow.li/media/images/800/termuxwidget1.webp?chash=Iebu8faa7b 800w, https://glow.li/media/images/700/termuxwidget1.webp?chash=Iebu8faa7b 700w, https://glow.li/media/images/600/termuxwidget1.webp?chash=Iebu8faa7b 600w, https://glow.li/media/images/500/termuxwidget1.webp?chash=Iebu8faa7b 500w, https://glow.li/media/images/400/termuxwidget1.webp?chash=Iebu855039 400w, https://glow.li/media/images/300/termuxwidget1.webp?chash=Iebu82a7ab 300w, https://glow.li/media/images/200/termuxwidget1.webp?chash=Iebu8f0603 200w, https://glow.li/media/images/100/termuxwidget1.webp?chash=Iebu81bea0 100w" &gt;&lt;/a&gt;
I managed to build a bridge between &lt;a href="https://termux.com/"&gt;Termux&lt;/a&gt; and &lt;a href="https://play.google.com/store/apps/details?id=de.devmil.minimaltext"&gt;Minimalistic Text&lt;/a&gt; using &lt;a href="https://tasker.joaoapps.com/"&gt;Tasker&lt;/a&gt;. I use it to display the last 20 lines of the &lt;a href="https://gitter.im/termux/termux"&gt;#termux irc channel&lt;/a&gt; as you can see in the picture.
I've done it without having Tasker check a file every two minutes. The Task is directly called from the script.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This tutorial is not Termux specific and should work with any terminal emulator&lt;/em&gt;&lt;/p&gt;
&lt;h3 id="Step+1%3A+Creating+the+script" name="Step+1%3A+Creating+the+script"&gt;&lt;a class="hash-link" href="#Step+1%3A+Creating+the+script"&gt;Step 1: Creating the script&lt;/a&gt;&lt;/h3&gt;
&lt;!-- more --&gt;
&lt;p&gt;All you have to do is write your output to a file in &lt;code&gt;/sdcard/&lt;/code&gt;. In this example I am grabbing the last 20 lines of log of the &lt;a href="https://gitter.im/termux/termux"&gt;#termux irc channel&lt;/a&gt; from my server.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while true; do
  # You can basically add your own commands here. They just have to write
  # their output to `/sdcard/widget`

  # For maximum battery and bandwidth efficiency tail and cut are
  # executed on the server
  # the cut command removes the timestamps
  #
  # for this to work you need to have placed your public key on the server.
  # Otherwise you will need to enter your password every two minutes
  ssh user@example.com "cat ~/.weechat/logs/irc.freenode.#termux.weechatlog |tail -n 20 | cut -c 21-"&amp;gt;/sdcard/widget

  # This sends an Intent. This is how we'll call the Tasker task which
  # updates the widget. "net.dinglish.tasker" has to be there every
  # time for tasker to receive the intent. The last part is the name
  # of the intent which you can change if you want more than one.
  # This normally produces a bit of useless output. I am removing #
  #that with `&amp;gt;/dev/null`
  am broadcast -a net.dinglish.tasker.updatewidget --user 0 &amp;gt;/dev/null

  # sleep for 120 seconds. How often it should update the widget.
  sleep 120
done&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you run this it will download the last 20 lines of the log from a server, paste it into &lt;code&gt;/sdcard/widget&lt;/code&gt; and call Tasker with an Intent.&lt;/p&gt;
&lt;p&gt;You should also create the file &lt;code&gt;/sdcard/widget&lt;/code&gt; now. Simply do &lt;code&gt;touch /sdcard/widget&lt;/code&gt;.
&lt;img src="https://glow.li/media/images/termuxwidget2.webp?chash=Iebu85f8a9" alt="Screenshot" title="Screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget2.webp?chash=Iebu85f8a9 1500w, https://glow.li/media/images/1200/termuxwidget2.webp?chash=Iebu884cb8 1200w, https://glow.li/media/images/1000/termuxwidget2.webp?chash=Iebu884cb8 1000w, https://glow.li/media/images/800/termuxwidget2.webp?chash=Iebu884cb8 800w, https://glow.li/media/images/700/termuxwidget2.webp?chash=Iebu884cb8 700w, https://glow.li/media/images/600/termuxwidget2.webp?chash=Iebu884cb8 600w, https://glow.li/media/images/500/termuxwidget2.webp?chash=Iebu884cb8 500w, https://glow.li/media/images/400/termuxwidget2.webp?chash=Iebu884cb8 400w, https://glow.li/media/images/300/termuxwidget2.webp?chash=Iebu878cc7 300w, https://glow.li/media/images/200/termuxwidget2.webp?chash=Iebu837023 200w, https://glow.li/media/images/100/termuxwidget2.webp?chash=Iebu8b9674 100w" &gt;{ .right}&lt;/p&gt;
&lt;h3 id="Step+2%3A+Create+a+Tasker+profile" name="Step+2%3A+Create+a+Tasker+profile"&gt;&lt;a class="hash-link" href="#Step+2%3A+Create+a+Tasker+profile"&gt;Step 2: Create a Tasker profile&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Create a new profile&lt;/li&gt;
&lt;li&gt;Choose "Event"&lt;/li&gt;
&lt;li&gt;In the "Select Event Category" dialog choose "System"-&amp;gt;"Intent Received"&lt;/li&gt;
&lt;li&gt;As Action define &lt;code&gt;net.dinglish.tasker.updatewidget&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This profile will now be called whenever it recieves the "updatewidget" intent. This is a usefull way to extend the functionality of Termux. I also use it to kick of some &lt;a href="https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.lite"&gt;Foldersync&lt;/a&gt; jobs from the terminal.&lt;/p&gt;
&lt;h3 id="Step+3%3A+Create+the+Task" name="Step+3%3A+Create+the+Task"&gt;&lt;a class="hash-link" href="#Step+3%3A+Create+the+Task"&gt;Step 3: Create the Task&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/termuxwidget3.webp?chash=Iebu846bdf" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/termuxwidget3.webp?chash=Iebu846bdf 1500w, https://glow.li/media/images/1200/termuxwidget3.webp?chash=Iebu88f235 1200w, https://glow.li/media/images/1000/termuxwidget3.webp?chash=Iebu88f235 1000w, https://glow.li/media/images/800/termuxwidget3.webp?chash=Iebu88f235 800w, https://glow.li/media/images/700/termuxwidget3.webp?chash=Iebu88f235 700w, https://glow.li/media/images/600/termuxwidget3.webp?chash=Iebu88f235 600w, https://glow.li/media/images/500/termuxwidget3.webp?chash=Iebu88f235 500w, https://glow.li/media/images/400/termuxwidget3.webp?chash=Iebu88f235 400w, https://glow.li/media/images/300/termuxwidget3.webp?chash=Iebu8b3a95 300w, https://glow.li/media/images/200/termuxwidget3.webp?chash=Iebu82abf2 200w, https://glow.li/media/images/100/termuxwidget3.webp?chash=Iebu8db09b 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tap "New Task" and give it a name&lt;/li&gt;
&lt;li&gt;Tap + to add a new Action&lt;/li&gt;
&lt;li&gt;Choose "File"-&amp;gt;"Read File"&lt;/li&gt;
&lt;li&gt;Tap 🔍 and choose &lt;code&gt;/sdcard/widget&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Under "To Var" enter &lt;code&gt;%Widget&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Tap + again to add another new Action&lt;/li&gt;
&lt;li&gt;Choose "Plugin"-&amp;gt;"Minimalistic Text"-&amp;gt;"Minimalistic Text"&lt;/li&gt;
&lt;li&gt;Click the pen to edit the configuration&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;%Widget&lt;/code&gt; for both variable name and variable content&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="Step+4%3A+Configure+Minimalistic+Text" name="Step+4%3A+Configure+Minimalistic+Text"&gt;&lt;a class="hash-link" href="#Step+4%3A+Configure+Minimalistic+Text"&gt;Step 4: Configure Minimalistic Text&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Add a Minimalistic Text widget to your homescreen&lt;/li&gt;
&lt;li&gt;Choose any preset&lt;/li&gt;
&lt;li&gt;In the "layout" tab remove remove all rows. Now you have a blank widget&lt;/li&gt;
&lt;li&gt;Add a new element with +&lt;/li&gt;
&lt;li&gt;Switch "Misc" Tab and tick "Locale variable"&lt;/li&gt;
&lt;li&gt;Tap "OK"&lt;/li&gt;
&lt;li&gt;Click on the new "Locale variable" element&lt;/li&gt;
&lt;li&gt;In the popup enter &lt;code&gt;%Widget&lt;/code&gt; as a the "Variable name"&lt;/li&gt;
&lt;li&gt;"OK" and Save&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/termuxwidget5.webp?chash=Iebu8c0ca4" alt="Screenshot" title="Screenshot" class="inline" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget5.webp?chash=Iebu8c0ca4 1500w, https://glow.li/media/images/1200/termuxwidget5.webp?chash=Iebu8ec65c 1200w, https://glow.li/media/images/1000/termuxwidget5.webp?chash=Iebu8ec65c 1000w, https://glow.li/media/images/800/termuxwidget5.webp?chash=Iebu8ec65c 800w, https://glow.li/media/images/700/termuxwidget5.webp?chash=Iebu8ec65c 700w, https://glow.li/media/images/600/termuxwidget5.webp?chash=Iebu8ec65c 600w, https://glow.li/media/images/500/termuxwidget5.webp?chash=Iebu8ec65c 500w, https://glow.li/media/images/400/termuxwidget5.webp?chash=Iebu8ec65c 400w, https://glow.li/media/images/300/termuxwidget5.webp?chash=Iebu825bae 300w, https://glow.li/media/images/200/termuxwidget5.webp?chash=Iebu80b8c7 200w, https://glow.li/media/images/100/termuxwidget5.webp?chash=Iebu830122 100w" &gt;
&lt;img src="https://glow.li/media/images/termuxwidget4.webp?chash=Iebu89d038" alt="Screenshot" title="Screenshot" class="inline" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/termuxwidget4.webp?chash=Iebu89d038 1500w, https://glow.li/media/images/1200/termuxwidget4.webp?chash=Iebu871916 1200w, https://glow.li/media/images/1000/termuxwidget4.webp?chash=Iebu871916 1000w, https://glow.li/media/images/800/termuxwidget4.webp?chash=Iebu871916 800w, https://glow.li/media/images/700/termuxwidget4.webp?chash=Iebu871916 700w, https://glow.li/media/images/600/termuxwidget4.webp?chash=Iebu871916 600w, https://glow.li/media/images/500/termuxwidget4.webp?chash=Iebu871916 500w, https://glow.li/media/images/400/termuxwidget4.webp?chash=Iebu871916 400w, https://glow.li/media/images/300/termuxwidget4.webp?chash=Iebu8a7454 300w, https://glow.li/media/images/200/termuxwidget4.webp?chash=Iebu8b822b 200w, https://glow.li/media/images/100/termuxwidget4.webp?chash=Iebu8ef637 100w" &gt;&lt;/p&gt;
&lt;h3 id="Step+5%3A+Run+the+script" name="Step+5%3A+Run+the+script"&gt;&lt;a class="hash-link" href="#Step+5%3A+Run+the+script"&gt;Step 5: Run the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now you can run the script in Termux. Your widget should get updated right away.&lt;/p&gt;</description>
    <pubDate>Tue, 16 Feb 2016 00:01:00 +0000</pubDate>
    <link>https://glow.li/posts/display-output-of-a-bash-script-on-a-widget/</link>
    <guid isPermaLink="false">1455580860</guid>
</item>

<item>
        <title>Display Swatch Internet Time (beats) in Zooper</title>
        <description>&lt;p&gt;&lt;a href="https://glow.li/media/images/big/beat-screenshot.webp?chash=Iebu8ce7ec"&gt;&lt;img src="https://glow.li/media/images/beat-screenshot.webp?chash=Iebu85149a" alt="beat screenshot" title="beat screenshot" loading="lazy" sizes="(max-width:800px) 100vw, (max-width:800px) 100vw, (max-width:1000px) 80vw, (max-width:1200px) 67vw, (max-width:1400px) 58vw, (max-width:1600px) 50vw, (max-width:1800px) 45vw, (max-width:2000px) 40vw, (max-width:2200px) 37vw, (max-width:2400px) 34vw, (max-width:2600px) 31vw, (max-width:2800px) 29vw, 1500px" srcset="https://glow.li/media/images/beat-screenshot.webp?chash=Iebu85149a 1500w, https://glow.li/media/images/1200/beat-screenshot.webp?chash=Iebu85130c 1200w, https://glow.li/media/images/1000/beat-screenshot.webp?chash=Iebu85130c 1000w, https://glow.li/media/images/800/beat-screenshot.webp?chash=Iebu85130c 800w, https://glow.li/media/images/700/beat-screenshot.webp?chash=Iebu85130c 700w, https://glow.li/media/images/600/beat-screenshot.webp?chash=Iebu85130c 600w, https://glow.li/media/images/500/beat-screenshot.webp?chash=Iebu81013e 500w, https://glow.li/media/images/400/beat-screenshot.webp?chash=Iebu89e1aa 400w, https://glow.li/media/images/300/beat-screenshot.webp?chash=Iebu8d636d 300w, https://glow.li/media/images/200/beat-screenshot.webp?chash=Iebu84c7b9 200w, https://glow.li/media/images/100/beat-screenshot.webp?chash=Iebu894560 100w" &gt;&lt;/a&gt;
Did you ever want Zooper to display Time in &lt;a href="https://en.wikipedia.org/wiki/Swatch_Internet_Time"&gt;.beats&lt;/a&gt;? Probably not. Here's how anyway:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@$(floor(((#Dss#)+(#Dmm#*60)+((#DH#+1)*3600))/86.4))$&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This does the math. Just add a Text or Rich Text module, "Edit text manually" and insert this.&lt;/p&gt;
&lt;p&gt;You will have to also tap "Override widget Locality" add a location, enter any city and manually set the timezone to UTC. This is because it Swatch Internet Time doesn't have time zones but can be calculated from Biel Meantime (BMT). @0 is midnight in Biel, where the Swatch headquarters is located.&lt;/p&gt;
&lt;p&gt;You can also download this as a template: &lt;a href="https://glow.li/media/files/Swatch_Internet_Time.zw"&gt;Swatch Internet Time.zw&lt;/a&gt;&lt;/p&gt;</description>
    <pubDate>Fri, 30 Oct 2015 18:17:50 +0000</pubDate>
    <link>https://glow.li/posts/beats-with-zooper/</link>
    <guid isPermaLink="false">1446229070</guid>
</item>

    </channel>
</rss>

