<?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>termux on foosel.net</title><link>https://foosel.net/tags/termux/</link><description>Recent content in termux on foosel.net</description><generator>Hugo</generator><language>en-us</language><copyright>Gina Häußge (foosel)</copyright><lastBuildDate>Fri, 19 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://foosel.net/tags/termux/feed.xml" rel="self" type="application/rss+xml"/><item><title>How to manage this Hugo based page from my Android phone in 2026</title><link>https://foosel.net/til/2026-06-19-how-to-manage-this-page-from-my-phone-in-2026/</link><pubDate>Fri, 19 Jun 2026 00:00:00 +0000</pubDate><guid>https://foosel.net/til/2026-06-19-how-to-manage-this-page-from-my-phone-in-2026/</guid><description>&lt;p&gt;This TIL post is basically an update to my three year old post &lt;a href="https://foosel.net/blog/2023-01-21-hugo-meet-android/"&gt;&amp;ldquo;Hugo, meet Android&amp;rdquo;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I recently got a new phone and thus had to re-do the setup of my mobile blogging pipeline. So, basically, allow me to checkout, modify, test, commit and push the sources of this &lt;a href="https://gohugo.io/"&gt;Hugo based&lt;/a&gt; static page under Android. While doing so I noticed some necessary changes and improvements, and also wanted to make use of my &lt;a href="https://github.com/foosel/foosel.github.io/blob/master/Taskfile.yml"&gt;Taskfile&lt;/a&gt; which does most of the heavy lifting now, so here are my updated steps.&lt;/p&gt;</description><content:encoded><![CDATA[<p>This TIL post is basically an update to my three year old post <a href="/blog/2023-01-21-hugo-meet-android/">&ldquo;Hugo, meet Android&rdquo;</a>.</p>
<p>I recently got a new phone and thus had to re-do the setup of my mobile blogging pipeline. So, basically, allow me to checkout, modify, test, commit and push the sources of this <a href="https://gohugo.io/">Hugo based</a> static page under Android. While doing so I noticed some necessary changes and improvements, and also wanted to make use of my <a href="https://github.com/foosel/foosel.github.io/blob/master/Taskfile.yml">Taskfile</a> which does most of the heavy lifting now, so here are my updated steps.</p>
<h2 id="apps--permissions">Apps &amp; permissions</h2>
<ol>
<li>Install Tasker</li>
<li>From <strong>F-Droid</strong> install
<ul>
<li>Termux</li>
<li>Termux:Tasker</li>
<li>Markor</li>
</ul>
</li>
<li>Grant permissions
<ul>
<li>Tasker: Run commands via Termux</li>
<li>Termux: Draw over apps</li>
</ul>
</li>
</ol>
<h2 id="termux-setup">Termux setup</h2>
<div class="highlight"><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"># setup access to storage</span>
</span></span><span style="display:flex;"><span>termux-setup-storage
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># install packages</span>
</span></span><span style="display:flex;"><span>pkg upgrade
</span></span><span style="display:flex;"><span>pkg install git gh hugo iconv vim
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># log into github</span>
</span></span><span style="display:flex;"><span>gh auth login
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># navigate to Markor&#39;s document folder &amp; checkout sources</span>
</span></span><span style="display:flex;"><span>cd storage/shared/Documents/markor
</span></span><span style="display:flex;"><span>git clone --recurse-submodules https://github.com/foosel/foosel.github.io
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># create symlink in home</span>
</span></span><span style="display:flex;"><span>ln -s foosel.github.io ~/foosel.net
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># mark checkout as safe</span>
</span></span><span style="display:flex;"><span>git config --global --add safe.directory /storage/emulated/0/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># set git user metadata</span>
</span></span><span style="display:flex;"><span>git config --global user.email <span style="color:#e6db74">&#34;you@example.com&#34;</span>
</span></span><span style="display:flex;"><span>git config --global user.name <span style="color:#e6db74">&#34;Your Name&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># we want to use our Taskfile...</span>
</span></span><span style="display:flex;"><span>pkg install golang
</span></span><span style="display:flex;"><span>go install github.com/go-task/task/v3/cmd/task@latest
</span></span></code></pre></div><p>As Tasker will stay the <em>only</em> app on my system allowed to send commands to Termux, and I write all my tasks myself, I also added <code>allow-external-apps=true</code>  to <code>.termux/termux.properties</code> as described <a href="https://github.com/termux/termux-tasker#allow-external-apps-property-optional">here</a>. That allows me to directly execute stuff from Tasker by absolute path vs having to add a bunch of wrapper scripts to <code>~/.termux/shortcuts</code></p>
<p>To quickly test if everything works so far:</p>
<div class="highlight"><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>cd ~/foosel.net
</span></span><span style="display:flex;"><span>task serve
</span></span></code></pre></div><p>This should build the page and serve it on <code>http://127.0.0.1:1313</code> (with auto reload).</p>
<h2 id="tasker-setup">Tasker setup</h2>
<p>I created a bunch of tasks, gave all of them an icon and added them to my launcher.</p>
<h3 id="serve-fooselnet">Serve foosel.net</h3>
<pre tabindex="0"><code>    Task: Serve foosel.net
    
    A1: Termux [
         Configuration: ~/go/bin/task serve
         
         Working Directory ✓
         Terminal Session ✓
         Wait For Result ✕
         Timeout (Seconds): 10
         Structure Output (JSON, etc): On ]
    
</code></pre><h3 id="pull-fooselnet">Pull foosel.net</h3>
<pre tabindex="0"><code>    Task: Pull foosel.net
    
    A1: Termux [
         Configuration: /data/data/com.termux/files/usr/bin/git pull
         
         Working Directory ✓
         Stdin ✕
         Custom Log Level null
         Terminal Session ✕
         Wait 
         Timeout (Seconds): 10
         Structure Output (JSON, etc): On ]
    
    A2: Flash [
         Text: Pulled foosel.net sources
         Continue Task Immediately: On
         Dismiss On Click: On ]
    
</code></pre><h3 id="push-fooselnet">Push foosel.net</h3>
<pre tabindex="0"><code>    Task: Push foosel.net
    
    A1: Termux [
         Configuration: /data/data/com.termux/files/usr/bin/git push
         
         Working Directory ✓
         Stdin ✕
         Custom Log Level null
         Terminal Session ✕
         Wait 
         Timeout (Seconds): 10
         Structure Output (JSON, etc): On ]
    
    A2: Flash [
         Text: Pushed foosel.net sources
         Continue Task Immediately: On
         Dismiss On Click: On ]
    
</code></pre><h3 id="new-blog-post">New Blog Post</h3>
<pre tabindex="0"><code>    Task: New Blog Post
    
    A1: Input Dialog [
         Title: New post
         Text: Enter title
         Close After (Seconds): 120
         Input Type: 540673 ]
    
    A2: Termux [
         Configuration: ~/.local/bin/task new-blog -- &#34;%input&#34;
         
         Working Directory ✓
         Stdin ✕
         Custom Log Level null
         Terminal Session ✕
         Wait For Re
         Timeout (Seconds): 10
         Structure Output (JSON, etc): On ]
    
    A3: JavaScriptlet [
         Code: var uri = &#34;content://net.dinglisch.android.taskerm.fileprovider/storage/emulated/0/Documents/markor/foosel.github.io/&#34; + stdout.trim();
         Auto Exit: On
         Timeout (Seconds): 45 ]
    
    A4: Send Intent [
         Cat: None
         Mime Type: text/markdown
         Data: %uri
         Package: net.gsantner.markor
         Class: net.gsantner.markor.activity.DocumentActivity
         Target: Activity ]
</code></pre><h3 id="new-til-post">New TIL Post</h3>
<pre tabindex="0"><code>    Task: New TIL Post
    
    A1: Input Dialog [
         Title: New TIL
         Text: Enter title
         Close After (Seconds): 120
         Input Type: 540673 ]
    
    A2: Termux [
         Configuration: ~/.local/bin/task new-til -- &#34;%input&#34;
         
         Working Directory ✓
         Stdin ✕
         Custom Log Level null
         Terminal Session ✕
         Wait For Res
         Timeout (Seconds): 10
         Structure Output (JSON, etc): On ]
    
    A3: JavaScriptlet [
         Code: var uri = &#34;content://net.dinglisch.android.taskerm.fileprovider/storage/emulated/0/Documents/markor/foosel.github.io/&#34; + stdout.trim();
         Auto Exit: On
         Timeout (Seconds): 45 ]
    
    A4: Send Intent [
         Cat: None
         Mime Type: text/markdown
         Data: %uri
         Package: net.gsantner.markor
         Class: net.gsantner.markor.activity.DocumentActivity
         Target: Activity ]
</code></pre><h3 id="result">Result</h3>
<p>I now have all these tasks available under a tag in my launcher (<a href="https://kvaesitso.mm20.de/">Kvaesitso</a>) and can easily work on posts from my phone once more. In fact, this post was entirely written on it.</p>
<p><img alt="My launcher showing all created Tasker tasks as shortcuts, as well as a Firefox shortcut to the local page, plus Markor and Termux" loading="lazy" src="/til/2026-06-19-how-to-manage-this-page-from-my-phone-in-2026/shortcuts.png"></p>
<p>The whole pipeline is a bit slimmer than last time as well and required less bash wrappers, which I like a lot better 👍</p>
<p>I also decided to go a bit more commandline-centric in this iteration - <code>git add</code> and <code>git commit</code> I&rsquo;ll actually run manually in Termux this time around (I rarely used the corresponding shortcuts I created last time).</p>
<p>Once I&rsquo;m satisfied with the local preview and have committed, a <code>git push</code> is all that I need for publishing - the CI does the rest.</p>
]]></content:encoded></item><item><title>How to detect Termux in a script</title><link>https://foosel.net/til/2023-01-23-how-to-detect-termux-in-a-script/</link><pubDate>Mon, 23 Jan 2023 00:00:00 +0000</pubDate><guid>https://foosel.net/til/2023-01-23-how-to-detect-termux-in-a-script/</guid><description>&lt;p&gt;If you need to detect whether you are running in Termux from a bash script, check if &lt;code&gt;$PREFIX&lt;/code&gt; contains the string &lt;code&gt;com.termux&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;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;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo $PREFIX | grep -o &lt;span style="color:#e6db74"&gt;&amp;#34;com.termux&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This can also be used to set a variable in a &lt;a href="https://taskfile.dev"&gt;Taskfile&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;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;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;TERMUX&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#39;{{and .PREFIX (contains &amp;#34;com.termux&amp;#34; .PREFIX)}}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="https://www.reddit.com/r/termux/comments/co46qw/how_to_detect_in_a_bash_script_that_im_in_termux/"&gt;Source&lt;/a&gt;&lt;/p&gt;</description><content:encoded><![CDATA[<p>If you need to detect whether you are running in Termux from a bash script, check if <code>$PREFIX</code> contains the string <code>com.termux</code>:</p>
<div class="highlight"><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>echo $PREFIX | grep -o <span style="color:#e6db74">&#34;com.termux&#34;</span>
</span></span></code></pre></div><p>This can also be used to set a variable in a <a href="https://taskfile.dev">Taskfile</a>:</p>
<div class="highlight"><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-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">vars</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">TERMUX</span>: <span style="color:#e6db74">&#39;{{and .PREFIX (contains &#34;com.termux&#34; .PREFIX)}}&#39;</span>
</span></span></code></pre></div><p><a href="https://www.reddit.com/r/termux/comments/co46qw/how_to_detect_in_a_bash_script_that_im_in_termux/">Source</a></p>
]]></content:encoded></item><item><title>Hugo, meet Android</title><link>https://foosel.net/blog/2023-01-21-hugo-meet-android/</link><pubDate>Sat, 21 Jan 2023 00:00:00 +0000</pubDate><guid>https://foosel.net/blog/2023-01-21-hugo-meet-android/</guid><description>Setting up a mobile blogging workflow</description><content:encoded><![CDATA[<p><em><strong>Update from 2026-06-19</strong>: I went through these steps again after getting a new phone and had to change some things here and there while also improving other bits. You can find an update <a href="/til/how-to-manage-this-page-from-my-phone-in-2026/">here</a>.</em></p>
<p>One thing that kept me from blogging more so far was the difficulty in working on posts on my phone. So after switching this blog over to Hugo I decided to see if I couldn&rsquo;t improve on this situation.</p>
<p>I needed a solution that would allow me to</p>
<ol>
<li>Checkout my page&rsquo;s git repository from GitHub</li>
<li>Quickly create a new post, consisting of a new folder inside <code>content/blog</code> matching my chosen <code>&lt;year&gt;-&lt;month&gt;-&lt;day&gt;-&lt;title slug&gt;/index.md</code> folder structure, based on just a title</li>
<li>Allow me to edit the post, preferably in a text editor focused on Markdown (and ideally allow me to preview the post as well)</li>
<li>Optional: Run the Hugo build on my phone as well for final checks</li>
<li>Finally, commit the new post and push it so that my GitHub Action workflow can take care of the rest</li>
</ol>
<p>I started hunting for options, and I&rsquo;m happy to report that for now I seem to have found a - quite geeky - solution that involves the use of <a href="https://termux.dev/en">Termux</a> (Linux terminal environment for Android), <a href="https://gsantner.net/project/markor.html">Markor</a> (Markdown editor) and <a href="https://tasker.joaoapps.com/">Tasker</a> (Automation tool)<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>.</p>
<p>I installed Termux, Termux:Tasker, Termux:Widget and Markor via <a href="https://f-droid.org/">F-Droid</a> - the versions available on Google Play are outdated and no longer supported. I already had Tasker installed, but I made sure to give it the additional permission to send commands to Termux. For Termux, I also made sure to allow it to draw over other apps.</p>
<p>I then fired up Termux and took care of storage access and some packages first:</p>
<pre tabindex="0"><code>termux-setup-storage
pkg upgrade
pkg install git gh hugo iconv vim
</code></pre><p>Markor&rsquo;s default folder is located at <code>Documents/markor</code> and so this is where I decided to checkout my page&rsquo;s repository to. I also made sure to set some config settings needed for stuff to work<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup>:</p>
<pre tabindex="0"><code>gh auth login
cd storage/shared/Documents/markor
git clone https://github.com/foosel/foosel.github.io
git config --global --add safe.directory /storage/emulated/0/Documents/markor/foosel.github.io
git config --global user.email &#34;you@example.com&#34;
git config --global user.name &#34;Your Name&#34;
</code></pre><p>Next I took care of some helper scripts for Termux:Widget and Tasker. I first created some folders:</p>
<pre tabindex="0"><code>mkdir -p ~/.shortcuts
chmod 700 -R ~/.shortcuts
mkdir -p ~/.termux/tasker
chmod 700 -R ~/.termux/tasker
</code></pre><p>Then I added some helper scripts to them:</p>
<p><code>~/.shortcuts/pull_blog</code></p>
<div class="highlight"><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">#!/bin/sh
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd ~/storage/shared/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>git pull
</span></span></code></pre></div><p><code>~/.shortcuts/push_blog</code></p>
<div class="highlight"><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">#!/bin/sh
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd ~/storage/shared/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>git push
</span></span></code></pre></div><p><code>~/.termux/tasker/serve_blog</code></p>
<div class="highlight"><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">#!/bin/sh
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd ~/storage/shared/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>hugo server -D -F --noBuildLock
</span></span></code></pre></div><p><code>~/.termux/tasker/new_blog_post</code></p>
<div class="highlight"><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">#!/bin/bash
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>checkout<span style="color:#f92672">=</span>~/storage/shared/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>slugify <span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>     echo <span style="color:#e6db74">&#34;</span>$1<span style="color:#e6db74">&#34;</span> | iconv -t ascii//TRANSLIT | sed -r s/<span style="color:#f92672">[</span>~<span style="color:#ae81ff">\^</span><span style="color:#f92672">]</span>+//g | sed -r s/<span style="color:#f92672">[</span>^a-zA-Z0-9<span style="color:#f92672">]</span>+/-/g | sed -r s/^-+<span style="color:#ae81ff">\|</span>-+$//g | tr A-Z a-z
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>title<span style="color:#f92672">=</span>$1
</span></span><span style="display:flex;"><span>date<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>date +%Y-%m-%d<span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>slug<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>slugify <span style="color:#e6db74">&#34;</span>$title<span style="color:#e6db74">&#34;</span><span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd $checkout
</span></span><span style="display:flex;"><span>mkdir -p content/blog/$date-$slug
</span></span><span style="display:flex;"><span>cat &gt; content/blog/$date-$slug/index.md <span style="color:#e6db74">&lt;&lt;EOF
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">---
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">title: &#34;$title&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">date: $date
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">draft: true
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">---
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">EOF</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>echo $date-$slug/index.md
</span></span></code></pre></div><p><code>~/.termux/tasker/commit_blog</code></p>
<div class="highlight"><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">#!/bin/sh
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>message<span style="color:#f92672">=</span>$1
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd ~/storage/shared/Documents/markor/foosel.github.io
</span></span><span style="display:flex;"><span>git add .
</span></span><span style="display:flex;"><span>git commit -m <span style="color:#e6db74">&#34;</span>$message<span style="color:#e6db74">&#34;</span>
</span></span></code></pre></div><p><code>pull_blog</code> and <code>push_blog</code> take care of git synchronization.</p>
<p><code>serve_blog</code> runs Hugo with draft and future posts visible. The page can be viewed in the browser on the phone at <code>http://localhost:1313</code>.</p>
<p><code>new_blog_post</code> takes a post title as its first argument and from that creates the aforementioned folder structure within the <code>content/blog</code> folder, including a prefilled <code>index.md</code>.<sup id="fnref:3"><a href="#fn:3" class="footnote-ref" role="doc-noteref">3</a></sup></p>
<p>And finally <code>commit_blog</code> takes a commit message as its first argument, stages all changes in the checkout and commits them with the supplied message.</p>
<p>Next, I created Termux:Widget widgets on my desktop for <code>pull_blog</code>, <code>push_blog</code> and <code>run_hugo</code>.</p>
<p>Then I opened Tasker and created two new tasks:</p>
<div class="highlight"><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-plain" data-lang="plain"><span style="display:flex;"><span>    Task: New Post
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A1: Input Dialog [
</span></span><span style="display:flex;"><span>         Title: New post
</span></span><span style="display:flex;"><span>         Text: Enter title
</span></span><span style="display:flex;"><span>         Close After (Seconds): 30
</span></span><span style="display:flex;"><span>         Input Type: 540673 ]
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A2: Termux [
</span></span><span style="display:flex;"><span>         Configuration: new_blog_post &#34;%input&#34;
</span></span><span style="display:flex;"><span>         
</span></span><span style="display:flex;"><span>         Working Directory ✕
</span></span><span style="display:flex;"><span>         Stdin ✕
</span></span><span style="display:flex;"><span>         Custom Log Level null
</span></span><span style="display:flex;"><span>         Terminal Session ✕
</span></span><span style="display:flex;"><span>         Wait For Result ✓
</span></span><span style="display:flex;"><span>         Timeout (Seconds): 10
</span></span><span style="display:flex;"><span>         Structure Output (JSON, etc): On ]
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A3: JavaScriptlet [
</span></span><span style="display:flex;"><span>         Code: var uri = &#34;content://net.dinglisch.android.taskerm.fileprovider/external_files/storage/emulated/0/Documents/markor/foosel.github.io/content/blog/&#34; + stdout.trim();
</span></span><span style="display:flex;"><span>         Auto Exit: On
</span></span><span style="display:flex;"><span>         Timeout (Seconds): 45 ]
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A4: Send Intent [
</span></span><span style="display:flex;"><span>         Action: android.intent.action.SEND
</span></span><span style="display:flex;"><span>         Cat: None
</span></span><span style="display:flex;"><span>         Mime Type: text/markdown
</span></span><span style="display:flex;"><span>         Data: %uri
</span></span><span style="display:flex;"><span>         Package: net.gsantner.markor
</span></span><span style="display:flex;"><span>         Class: net.gsantner.markor.activity.DocumentActivity
</span></span><span style="display:flex;"><span>         Target: Activity ]
</span></span></code></pre></div><div class="highlight"><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-plain" data-lang="plain"><span style="display:flex;"><span>    Task: Commit Blog
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A1: Input Dialog [
</span></span><span style="display:flex;"><span>         Title: Commit Blog
</span></span><span style="display:flex;"><span>         Text: Enter commit message
</span></span><span style="display:flex;"><span>         Close After (Seconds): 30 ]
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    A2: Termux [
</span></span><span style="display:flex;"><span>         Configuration: commit_blog &#34;%input&#34;
</span></span><span style="display:flex;"><span>         
</span></span><span style="display:flex;"><span>         Working Directory ✕
</span></span><span style="display:flex;"><span>         Stdin ✕
</span></span><span style="display:flex;"><span>         Custom Log Level null
</span></span><span style="display:flex;"><span>         Terminal Session ✕
</span></span><span style="display:flex;"><span>         Wait For Result ✓
</span></span><span style="display:flex;"><span>         Timeout (Seconds): 10
</span></span><span style="display:flex;"><span>         Structure Output (JSON, etc): On ]
</span></span></code></pre></div><p>&ldquo;New Post&rdquo; queries a post title from the user, calls <code>new_post</code> with that and then opens the new post in Markor.</p>
<p>&ldquo;Commit Blog&rdquo; queries a commit message from the user and calls <code>commit_blog</code> with that.</p>
<p>I created desktop shortcuts for these too and placed all of them, together with Markor, Termux and a browser shortcut, in a new folder &ldquo;Blog&rdquo;.</p>
<p><img alt="Screenshot of the shortcut folder dedicated to my blog." loading="lazy" src="/blog/2023-01-21-hugo-meet-android/shortcuts.jpg"></p>
<p>So, my workflow now consists of pulling, creating a new post, editing it, optionally firing up Hugo to check on the whole thing locally, committing and pushing, all at least without <em>needing</em> to touch the terminal, but always <em>able</em> to if so desired.</p>
<p>It&rsquo;s not perfect, and some app that takes care of all of this from a nice UI would certainly be better (<em>hint hint</em>). But - as this post created entirely from my phone proves - it works for now 😁</p>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>Quick shoutout to <a href="https://pipe.how/write-androidblog/">this post by Emanuel Palm</a> who found himself in a similar situation (prior to boarding a plane to boot) and showed me the path on which I was then able to set up a neat workflow.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p>You&rsquo;ll obviously have to adjust that and the following bits with your own repo, name and email.&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:3">
<p>Note that I&rsquo;m aware of the existence of <code>hugo new</code>, however it insisted on prefilling the title with the date included and otherwise also felt a bit too inflexible, hence I decided to implement what I wanted directly in bash.&#160;<a href="#fnref:3" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded></item></channel></rss>