LINux on MOBile - ScalingLINMOB.net is a blog about LINux on MOBile devices. With the PinePhone (Pro) and Librem 5 shipping it is back to report on GNU+Linux on mobile devices.Zola2022-05-29T17:17:00+00:00https://linmob.net/tags/scaling/feed.xmlPinePhone Setup: More on Scaling in Phosh2021-02-13T18:45:00+00:002022-05-29T16:53:00+00:00https://linmob.net/pinephone-setup-scaling-in-phosh/<p><em>This post also applies to basically any phone that runs Phosh, be it one of the many postmarketOS devices, or — naturally — the Purism Librem 5.</em></p>
<span id="continue-reading"></span>
<p>Following up to my blog post detailing my setup, I was asked how exactly I scale web apps like Element to somewhat work in Firefox on the PinePhone. As the same applies to other web apps (e.g. Discord, more on that in a future blog post), I figured I should make a dedicated blog post detailing how I do that, as simply executing <code>ctrl</code>+<code>-</code> does not cut it.</p>
<h3 id="scaling-generally-normal-apps">Scaling, generally (Normal apps)</h3>
<p>First, let's reiterate how we can affect scaling generally in the GNOME on Mobile environment comprised of Phoc (compositor), Phosh (shell) and Squeekboard (virtual keyboard). </p>
<p>As not every app that might be useful does scale nicely out-of-the-box; meaning parts of the window will be off the screen and thus unreadable and untouchable.</p>
<p>There's a general "shotgun approach", that applies scaling to every app: </p>
<p><code>$ gsettings set sm.puri.phoc scale-to-fit true</code></p>
<p>I recommend a more nuanced approach as the global method can have negative side effects on optimized apps. This approach enables the forced scaling on a per-app-basis. To do that we need to have <code>scale-to-fit</code>, and a script, which I usually name <code>get-app-id.sh</code> and put in <code>~/.local/bin</code> (which is in my PATH).<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<pre><code>#!/bin/bash
WAYLAND_DEBUG=1 $1 |& grep 'xdg_toplevel@[0-9]\+\.set_app_id'
</code></pre>
<p>Just copy these two lines into a text file, e.g. named <code>get-app-id.sh</code>, on your PinePhone and make it executable by running <code>$ chmod +x get-app-id.sh</code>.</p>
<p>Let's say, you want to use KeePassXC, which does not scale well, but becomes somewhat usable by running <code>scale-to-fit</code>. But you won't get there by running <code>$ scale-to-fit keepassxc on</code>. You can now run <code>$ ./get-app-id.sh keepassxc</code> and <em>KeePassXC</em> will start up. Go back to your terminal and you will find a line of text similar to:</p>
<pre><code>[4049990.198] -> xdg_toplevel@21.set_app_id("org.keepassxc.KeePassXC")
</code></pre>
<p>The part between the "" is what you are looking for. Just run <code>$ scale-to-fit org.keepassxc.KeePassXC</code> in the terminal and the next time you start KeePassXC, it should be usable — or at least fit the screen.</p>
<p>The same works for Flatpak apps, as I've described in <a href="https://linmob.net/2020/07/27/pinephone-daily-driver-challenge-part2-flatpak-and-scaling-in-phosh.html#manual-scaling-in-phosh">a previous blog post</a>. </p>
<h4 id="phosh-0-14-0-phoc-0-9-0-and-later">Phosh 0.14.0/Phoc 0.9.0 and later</h4>
<p>As of Phosh 0.14.0/Phoc 0.9.0<sup class="footnote-reference"><a href="#2">2</a></sup> and later, the script above is no longer necessary for most apps — you can just use the proper App ID that <a href="https://linuxphoneapps.org">LinuxPhoneApps.org</a> lists (e.g. <code>org.gnome.Evolution</code> for Evolution or <code>org.gnome.calendar</code> for Calendar) instead of the output the script generates. </p>
<p>To figure out the app id in cases where the above approach does not work, try running</p>
<pre><code>$ /usr/lib/wlroots/foreign-toplevel
</code></pre>
<p>This command will tell you window titles and app ids of all running apps (that do have a window). In order to be able to use this command, you will need to install the <code>wlroots-examples</code> package on Debian and Debian-based distributions. On other distributions, the easiest way to get the program seems to be downloading the <a href="https://gitlab.freedesktop.org/wlroots/wlroots/">wlroots source code</a>, and to build it after extracting and changing into the folder by running</p>
<pre><code>$ meson build
$ cd build
$ ninja
</code></pre>
<p>You should then be able to find the foreign-toplevel executable among the build code and be able to run it. </p>
<p><em>Note:</em> Don't <code>ninja install</code> it, you don't want to interfere with what your distribution provides. Maybe move it to <code>~/.local/bin</code> for convenience, if you have some local binaries in that folder and it's in your PATH anyway.</p>
<h3 id="scaling-web-apps-changing-phoc-scaling">Scaling web apps/Changing phoc scaling</h3>
<p>For web apps, this method does not work. We need to take another route, that scales every UI element down, and thus makes the interface work on the smaller phone screen. By default, on PinePhone and Librem 5, the UI scaling is set to 2. </p>
<p>In a the blog post "<a href="https://puri.sm/posts/easy-librem-5-app-development-scale-the-screen/">Easy Librem 5 App Development: Scale the Screen</a>, Purism's Kyle Rankin describes a way to do this kind of scaling nicely via a graphical user interface. This "scale_screen" script is now part of a PureOS <a href="https://source.puri.sm/librem5-apps/librem5-goodies">package called l5-goodies</a>.</p>
<p>Dependencies for this script are <a href="https://github.com/emersion/wlr-randr">wlr-randr</a>, which is to Phoc (and other <a href="https://github.com/swaywm/wlroots">wlroots</a>-based compositors) what <em>xrandr</em> is to Xorg, and <a href="https://sourceforge.net/projects/yad-dialog/">yad</a> (short for "yet another dialog"), a tool for creating graphical dialogs from shell scripts. They should be packaged in your distribution of choice.</p>
<p>To use it, I just put <a href="https://source.puri.sm/librem5-apps/librem5-goodies/-/blob/master/l5-scale-the-screen">l5-scale-the-screen</a> in <code>~/.local/bin</code> and <a href="https://source.puri.sm/librem5-apps/librem5-goodies/-/blob/master/l5-scale-the-screen.desktop">l5-scale-the-screen.desktop</a> in <code>~/.local/share/applications</code>; again, these need to be in your PATH, which they likely are not by default.<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<p>With this, you can now easily make web apps like Element or Discord usable, the same applies to a few desktop apps. Just adjust the scaling until it fits your needs.
For general help on web apps with Firefox, read my <a href="https://linmob.net/2021/01/09/my-setup-with-danctnix-archlinuxarm.html">blog post about my PinePhone setup</a> and watch my video "Firefox Profiles and Site Specific Browsers on the PinePhone" on <a href="https://devtube.dev-wiki.de/videos/watch/165ca7c9-aa35-4b07-867f-74064542c9fd">PeerTube</a>, <a href="https://odysee.com/@linmob:3/firefox-profiles-and-site-specific:c">Odysee</a> or <a href="https://www.youtube.com/watch?v=h7aLE8jBOPc">YouTube</a>.</p>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>To see what's in your PATH and to learn how to add directories to your path, check out this <a href="https://www.howtogeek.com/658904/how-to-add-a-directory-to-your-path-in-linux/">HowToGeek.com</a> article. Please note that you will also need the file as executable, which is done with <code>chmod +x FILENAME</code>.</p>
</div>
<div class="footnote-definition" id="2"><sup class="footnote-definition-label">2</sup>
<p>See the <a href="https://gitlab.gnome.org/World/Phosh/phoc/-/releases#v0.9.0">Phoc 0.9.0 changelog</a>.</p>
</div>
Anbox on Mobian on the PinePhone (Android on PP #0)2020-08-15T13:55:00+00:002020-08-15T13:55:00+00:00https://linmob.net/anbox-on-the-pinephone/<p>By <a href="https://twitter.com/linmobblog/status/1293075978651078661">public</a> <a href="https://fosstodon.org/web/statuses/104670894757918964">demand</a> I finally made a <a href="https://www.youtube.com/watch?v=v06KUrfs69k">video about Anbox on the Pinephone</a>, which is one of the ways have Android apps on the Pinephone.</p>
<span id="continue-reading"></span><h3 id="introduction">Introduction</h3>
<p>I had tried <a href="https://anbox.io/">Anbox</a> before, way back when it was really popular (around ~2017). It also is really easy to install on <a href="https://postmarketos.org">postmarketOS</a>, where it is a <code>sudo apk add postmarketos-anbox</code> away, and I had failed to build it from the AUR (<a href="https://twitter.com/RealDanct12/status/1294309229516304390#m">Danct12 has pounced on the issue since</a>). Therefore I followed <a href="https://forum.pine64.org/showthread.php?tid=9815&pid=74676#pid74676">two</a> <a href="https://forum.pine64.org/showthread.php?tid=9815&pid=65378#pid65378">posts</a> on the pine64.org forums, which explain the process of installing Anbox on <a href="https://www.mobian-project.org/">Mobian</a> step by step. It's not easy, but at least to me, it seems that it runs faster on Mobian than it does on postmarketOS.</p>
<h3 id="setting-it-up">Setting it up</h3>
<p><em>These instructions are likely outdated. Please follow the more current <a href="https://wiki.mobian-project.org/doku.php?id=anbox">instructions to install Anbox on Mobian on the Mobian Wiki</a>.</em><sup class="footnote-reference"><a href="#1">1</a></sup></p>
<p>The following is a bland copy of the instructions on the Pine64 forum, with a handful changes, along to the <a href="https://gitlab.com/mobian1/issues/-/issues/63">Mobian Gitlab issue</a>. Therefore all credit goes to <em>nas</em>, <em>jed</em>, and <em>Djhg2000</em>.</p>
<h4 id="download-the-image-to-your-pinephone">Download the image to your PinePhone</h4>
<p><code>wget http://anbox.postmarketos.org/android-7.1.2_r39-anbox_arm64-userdebug.img</code> <sup class="footnote-reference"><a href="#2">2</a></sup> </p>
<h4 id="append-contrib-to-the-default-sourceslist">Append contrib to the default SourcesList</h4>
<blockquote>
<p><code>printf '%s' ' contrib' | sudo tee -a /etc/apt/sources.list</code> </p>
</blockquote>
<p>This did not work for me. Just open <code>/etc/apt/sources.list</code> in Vim or an editor of your choice as root and type a space and contrib after the word main, so that it looks like this afterwards:</p>
<p><code>deb http://deb.debian.org/debian bullseye main contrib</code></p>
<h4 id="update-and-install-the-requisite-packages">Update and install the requisite packages</h4>
<p><code>sudo apt update && sudo apt -y install anbox adb</code></p>
<h4 id="copy-the-android-image">Copy the Android image</h4>
<p><code>sudo mv android-7.1.2_r39-anbox_arm64-userdebug.img /var/lib/anbox/android.img</code></p>
<h4 id="create-a-new-service-file">Create a new service file</h4>
<p>Using your favourite editor, create the file <code>/etc/systemd/system/dev-binderfs.mount</code>:</p>
<pre><code>[Unit]
Description=binderfs
[Mount]
What=binder
Where=/dev/binderfs
Type=binder
[Install]
WantedBy=anbox-container-manager.service
</code></pre>
<h4 id="edit-the-anbox-container-manager-service-unit-file">Edit the anbox-container-manager.service unit file</h4>
<p>This fix originates from <a href="https://gitlab.com/mobian1/issues/-/issues/63">Mobian Issue #63</a>.</p>
<p>Change the file <code>/lib/systemd/system/anbox-container-manager.service</code> (lines 4, 6, 10, 11) so that it has the following content:</p>
<pre><code>[Unit]
Description=Anbox Container Manager
Documentation=man:anbox(1)
After=network.target dev-binderfs.mount
Wants=network.target
Requires=dev-binderfs.mount
ConditionPathExists=/var/lib/anbox/android.img
[Service]
#ExecStartPre=/sbin/modprobe ashmem_linux
#ExecStartPre=/sbin/modprobe binder_linux
ExecStartPre=/usr/share/anbox/anbox-bridge.sh start
ExecStart=/usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox
ExecStopPost=/usr/share/anbox/anbox-bridge.sh stop
[Install]
WantedBy=multi-user.target
</code></pre>
<h4 id="change-the-anbox-session-manager-service-unit-file">Change the anbox-session-manager.service unit file</h4>
<p>Change the file <code>/lib/systemd/user/anbox-session-manager.service</code> so that it has the following content:</p>
<pre><code>[Unit]
Description=Anbox Session Manager
Documentation=man:anbox(1)
After=graphical.target
Wants=graphical.target
[Service]
ExecStart=/usr/bin/anbox session-manager
[Install]
WantedBy=default.target
</code></pre>
<h4 id="reload-the-service-files">Reload the service files</h4>
<p><code>sudo systemctl daemon-reload</code></p>
<p><code>sudo systemctl restart anbox-container-manager.service</code></p>
<p><code>systemctl --user daemon-reload</code></p>
<p><code>systemctl --user restart anbox-session-manager.service</code></p>
<h4 id="try-it">Try it</h4>
<p>Anbox is now installed.
Anbox must be open to allow installation of APKs via adb, so start it.</p>
<p><code>anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity</code></p>
<p>A good first app to install is FDroid, the open-source Android store:</p>
<p>Download it:
<code>wget https://f-droid.org/F-Droid.apk</code>
and install it:</p>
<p><code>adb install F-Droid.apk</code></p>
<p>Android applications can be launched from the Phosh launcher (as .desktop files), or from the Anbox Application Manager.</p>
<h4 id="issues">Issues</h4>
<h5 id="not-enough-ram">Not enough RAM</h5>
<p>The 2GB RAM of the PinePhone are not that much, and Anbox is quite the RAM eater. Therefore, I use ZRAM with a really shitty script called <code>.zram.sh</code>, which has to be run as root:</p>
<pre><code>modprobe zram
echo 3.5G > /sys/block/zram0/disksize
mkswap --label zram0 /dev/zram0
swapon --priority 100 /dev/zram0
</code></pre>
<p>I really should do this via systemd, but did not get around to it yet.
The <a href="https://wiki.mobian-project.org/doku.php?id=tweaks#enable-zram">Mobian Wiki has more sane instructions</a> for that.</p>
<h5 id="internet-connection">Internet Connection</h5>
<p>While Anbox should work fine now even after reboots (as long as it has enough RAM), the network connection has to be set up manually every time, after a crash or a reboot:</p>
<pre><code>sudo /usr/share/anbox/anbox-shell.sh
su
ip route add default dev eth0 via 192.168.250.1
ip rule add pref 32766 table main
ip rule add pref 32767 table local
</code></pre>
<p>I already tried to simplify this step via <code>adb</code>, but after <code>adb root</code> adb does not find the Anbox emulator anymore.</p>
<p><strong>EDIT, 22:50h CEST:</strong> <em>Djhg2000 <a href="https://github.com/anbox/anbox/issues/443#issuecomment-674418196">added their findings</a> to a long standing issue at the Anbox project.</em></p>
<h5 id="keyboard">Keyboard</h5>
<p>As shown in my video, the Phosh keyboard, Squeekboard, does not work with Android. Apparently, <a href="https://source.puri.sm/Librem5/squeekboard/-/issues/218">this is a known bug with other SDL2 and Xwayland apps, too</a>. My temporary fix was to just install and enable (you will need to do so in the Android settings) an Android software keyboard. I tried multiple and had the best results with <a href="https://f-droid.org/en/packages/rkr.simplekeyboard.inputmethod/">Simple Keyboard</a>, which has an option to scale it's height — I settled on 125 %. Now, don't think that this is a perfect solution — it most definitely is not, as you can't see the keyboard, it shows as a black or white (and thus on a white background sometimes invisible) rectangle. <em>You will not see the keys, you will need to guess their positions!</em> But hey, it is working for text input.<sup class="footnote-reference"><a href="#1">1</a></sup> Another work around is, apparently according to the issue linked above, a hardware keyboard, e.g. a Bluetooth one. One more reason I can't wait for the <a href="https://www.pine64.org/2020/07/29/invitation-to-play-along/">Pine64 hardware keyboard for PinePhone</a>! </p>
<p><strong>EDIT, 21:45h CEST:</strong> <em>Replacing the Squeekboard binary with <a href="https://source.puri.sm/Librem5/virtboard">virtboard</a> works, too (<a href="https://twitter.com/linmobblog/status/1294717195566682114">tweet</a>).</em></p>
<h5 id="scaling">Scaling</h5>
<p>Apps look <em>blurry</em> - they apparently don't if you set Phosh to 1x scaling. That however comes with an entirely different set of issues, e.g. a miniscule virtual keyboard, which you would than have to adjust. I think I could deal with the blurryness, but it would be great to see that issue fixed.
Secondarily, apps always scale to the full height of the device. This in unfortunate, as Phosh has bars with UI elements on the top and bottom of the screen which then obscure your Android apps. I haven't seen anything on how to even attempt fixing this problem, and will update this post if I do.</p>
<p><strong>Added October 7th, 2020:</strong> You can temporarily (until the next restart) the Phosh UI element overlay issue by running <code>adb shell wm overscan 0,35,0,35</code> (<a href="https://twitter.com/linmobblog/status/1312696526859370496#m">tweet</a>).</p>
<h5 id="android-services">Android services</h5>
<p>Obviously, Anbox can only be a stop-gap solution to be used when there is no native or web-based alternative. Many of these apps may not work. One problem is that currently Android 7.1.2 (Nougat) is the most advanced release working with Anbox. Meanwhile, Google is working to get Android 11 ready. And: With the default image, you don't have any of Googles Play services, that many proprietary apps require (in case you are wondering, the <a href="https://f-droid.org/en/packages/com.aurora.store/">Aurora Store app</a> can tell you, whether a certain app you desire requires these services). MicroG, an open-source reimplementation of some of the Play Services, <a href="https://forum.pine64.org/showthread.php?tid=9815&pid=65378#pid65378">apparently works with Anbox</a>. Also, there are images for amd64-PCs with included Play Services [available in the Arch User Repository], but I don't know whether these still work — and assuiming they do work, Google could stop this any day.</p>
<h3 id="conclusion">Conclusion</h3>
<p>The current state of Anbox can be summarized with 'it sort of works'. Unfortunately, the 2GBs of RAM the PinePhone ships with, are a limiting factor here, and everybody who pre-ordered the Convergence Package can be extra happy, as that extra Gigabyte of RAM will come in handy here, too. While a few bugs that affect the operation of Anbox are likely to be fixed within a couple of weeks, others may take way longer or forever.
Luckily, there are other options to 'running' Android apps on the PinePhone, and I look forward to investigate and writing about these soon.</p>
<p><em>In case you read up to this point, and did not watch my video yet, now is a good time to head over to <a href="https://www.youtube.com/watch?v=v06KUrfs69k">YouTube</a> or an <a href="https://invidious.ad13.de/watch?v=v06KUrfs69k">invidious-instance</a>.</em> </p>
<p><strong>Added on August 16th, 2020:</strong> </p>
<h3 id="other-distributions">Other distributions <sup class="footnote-reference"><a href="#3">3</a></sup></h3>
<p>While the above describes how I did enable Anbox on Mobian, the instructions should apply to other distributions that use systemd, too. You will need to obtain an Anbox package though, which might be tough.</p>
<p>Getting Anbox to work should be particularily easy on ArchLinux ARM/Huong Tram Linux, as <em>Danct12</em> packaged Anbox for it. So become root, <code>pacman -S anbox anbox-image</code>, reboot and it should work just fine with a working keyboard and FDroid preinstalled. </p>
<p>Manjaro offers their Phosh images with Anbox (including the Android image) preinstalled <a href="https://osdn.net/projects/manjaro-arm/storage/pinephone/phosh/">for download</a>.</p>
<p>I have made further videos on Anbox and published them on YouTube:</p>
<ul>
<li><a href="https://www.youtube.com/watch?v=Y-9Wmki7DsU">PinePhone: Installing Anbox on Arch Linux ARM, trying WhatsApp and Signal</a>, <em>published September 6th, 2020.</em> </li>
<li><a href="https://www.youtube.com/watch?v=8Sha3R4PKSs">Manjaro Phosh Alpha 4: Anbox Community Service (Anbox on PinePhone III)</a>, <em>published September 29th, 2020.</em> </li>
</ul>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>This remark was added on December 25th, 2020.
<sup class="footnote-reference"><a href="#2">2</a></sup>: <em>October 7th, 2020</em>: You might want to look at the <a href="https://github.com/dreemurrs-embedded/Pine64-Arch/blob/master/PKGBUILDS/pine64/anbox-image/PKGBUILD">PKGBUILD for Arch Linux ARM</a> to patch the image to make it better. Networking, keyboard and so on work on Arch Linux ARM.g
<sup class="footnote-reference"><a href="#3">3</a></sup>: This section was added on August 16th, 2020 and last updated (and rewritten) on October 7th, 2020.</p>
</div>
PinePhone DDC pt. 4: Crossing (Desktop Environment) Boundaries2020-08-01T18:21:18+00:002020-08-01T18:21:18+00:00https://linmob.net/pinephone-daily-driver-challenge-part4-crossing-desktop-environment-boudaries/<p>This week is going to be about Flatpak, Reading apps and the intricacies of running (non-)Flatpak Qt and GTK apps on the respective "other side". Part 3: Crossing (Desktop Environment) Boundaries — running Qt/Plasma Mobile apps in Phosh.</p>
<span id="continue-reading"></span>
<p><strong>Caveat:</strong> <em>This post is going to be a one-way street. While GTK/Libhandy apps can also run on Plasma Mobile, they turned out to be utterly useless, as the software keyboard would refuse to work with them. Therefore, this is only about running Qt/PlasmaMobile apps on Phosh.</em></p>
<h3 id="introduction">Introduction</h3>
<p>The worlds of Desktop Linux have been carried over to the Mobile Linux phones. The KDE project have their own <a href="https://www.plasma-mobile.org/">Plasma Mobile</a> effort, and Purism started a GNOME Mobile effort for their Librem 5 smartphone.</p>
<p>Both are efforts are still in their early stages, both equally lack a few apps. That's why mixing and matching sounds like a good idea. As quite a few of these apps are packaged in distributions that support both efforts like postmarketOS and some of the apps are available as Flatpaks in Flathub or KdeApps, mixing and matching is just a few package installs away.</p>
<h3 id="theming-for-non-flatpak-apps">Theming for non Flatpak apps</h3>
<h4 id="option-1-qt5ct">Option 1: qt5ct</h4>
<p>If you want to set your theme in a detailed way using a GUI, just install <code>qt5ct</code> and add the line <code>QT_QPA_PLATFORMTHEME=qt5ct</code> to <code>/etc/environment</code> (as root).</p>
<h4 id="option-2-manually-setting-a-theme">Option 2: Manually setting a theme</h4>
<p>Add the line <code>QT_STYLE_OVERRIDE=themename</code> with themename being <code>adwaita</code> if you have Qt adwaita theme installed (warning: This may leed to missing icons, <a href="https://www.youtube.com/watch?v=Ka9zh0Vt3zM?t=252s">as explained in the "Theming Qt Apps" section of my video</a> or <code>breeze</code> (make sure it is installed) to <code>/etc/environment</code>.</p>
<h3 id="apps-you-really-should-try">Apps you really should try</h3>
<ul>
<li>Calindori (kdeapps, pmOS, AUR)</li>
<li>KDE Itinery and Ktrip (kdeapp s, pmOS) </li>
<li>Angelfish (kdeapps, pmOS, AUR)</li>
</ul>
<p>kdeapps refers to the KDE Apps Flatpak repo, which contains nightly releases of KDE Apps. I explained using/installing flatpaks <a href="https://linmob.net/2020/07/27/pinephone-daily-driver-challenge-part2-flatpak-and-scaling-in-phosh.html">in an earlier post</a>.</p>
<h3 id="figuring-out-missing-dependencies-for-non-flatpak-apps">Figuring out missing dependencies for non-Flatpak apps</h3>
<p>On postmarketOS, but also on the AUR, you might run into missing dependencies. Just try to run the app from the terminal and try to make sense of the output.</p>
<p>Now go and watch the <a href="https://www.youtube.com/watch?v=Ka9zh0Vt3zM">video</a>!</p>
PinePhone DDC pt. 3: Reading Apps and Email2020-07-31T21:53:18+00:002020-07-31T21:53:18+00:00https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/<p>I have decided to change my approach: Writing the post before shooting the third "PinePhone as a daily driver" video. This week is going to be about Flatpak, Reading apps and the intricacies of running (non-)Flatpak Qt and GTK apps on the respective "other side". Part 2: Reading apps and Email.</p>
<span id="continue-reading"></span>
<p><strong>Caveat:</strong> <em>For the past week I have been struggling with receiving calls on Phosh/ModemManager based distributions, approximately since the massive improvements in battery life due to new Crust firmware. I found another user suffering from this issue, but assuming my tweets are being read among PinePhone users, it does not seem to be a widespread problem. I am continuing with this series despite of these issues, but be aware that core functionality might be currently not available.</em></p>
<h3 id="reading-apps">Reading Apps</h3>
<p>I know, reading apps may not be the most pressing issue for a phone. But given the size of the PinePhones display, it can be quite good as a device that serves up text for the broadband interface of our human brains, the eyes.</p>
<h4 id="rss-apps">RSS apps</h4>
<p><em>Ever since I had that sidebar RSS plugin in Firefox way back when, I've been an RSS junkie.</em><br />
I was very upset when Google sunset Google Reader<sup class="footnote-reference"><a href="#1">1</a></sup>, but kept reading RSS feeds and eventually settled on <a href="https://miniflux.app">Miniflux</a> as a self-hosted solution. For a long time I did not find a Miniflux-compatible desktop RSS reader, but I became aware of one: It's called <a href="https://gitlab.com/news-flash/news_flash_gtk">News Flash</a>, is available on <a href="https://flathub.org/apps/details/com.gitlab.newsflash">Flathub</a> (also in Fedora and it can be built from the <a href="https://aur.archlinux.org/packages/newsflash/">AUR</a>) and supports the following services:</p>
<ul>
<li>feedbin</li>
<li>feedly</li>
<li>Fever </li>
<li>Miniflux</li>
<li>Local RSS</li>
</ul>
<p>News Flash does not scale perfectly on the PinePhone in Phosh, but a <code>scale-to-fit NewsFlashGTK on</code> makes it fit in really well. It just works, although switching from article to article has been implemented via keyboard shortcuts only currently. While you can just use the virtual keyboard for that, it blocks quite a large area that could be used for displaying text. Still, I use it this way, because let's face it: Not every item of news is that interesting, and then there is always a feed or two that only deliver an excerpt anyway, forcing you into a browser to read the entirety of the article anyway.</p>
<h4 id="read-it-later-clients">Read it Later clients</h4>
<p>Speaking of going through a ton of news items: Every now and then you will come across an article that is both interesting and too long to read in that situation. That's one of my uses of <a href="https://wallabag.org/en">Wallabag</a>, a self-hostable Read-it-later service (more popular, proprietary services include Instapaper and Pocket). Now, if you use Wallabag too, check out <a href="https://gitlab.gnome.org/World/read-it-later/">Read It Later</a>, an app written in Rust that is fully libhandy enabled and works perfectly, even though it just has the basic features (e.g. it lacks tags).
Read it Later is available on <a href="https://flathub.org/apps/details/com.belmoussaoui.ReadItLater">Flathub</a> and in the <a href="https://aur.archlinux.org/packages/?O=0&SeB=nd&K=read-it-later&outdated=&SB=n&SO=a&PP=50&do_Search=Go">AUR</a>.</p>
<h4 id="ebooks">eBooks</h4>
<p>I have to admit that I rarely read an ebook on my phone, but I recall doing that before I had a dedicated device. On the PinePhone with Phosh, Foliate as a modern GTK based ebook reader is the obvious choice, and guess what: After a <code>scale-to-fit com.github.johnfactotum.Foliate on</code> it even works quite well. Even if you don't have any ebooks yet, Foliate has currently three integrated catalogs that help you at obtaining (DRM free) ebooks. Most of these are in the public domain, but that does not make them less interesting, as I have found that having books that are lengthy and heavy if they were printed on paper actually are easier to read when you can take them with you to many places.
And thinking of a future in which the PinePhone can serve as a daily driver, don't you picture yourselves standing in a cue, reading Tolstoi?
Foliates catalogue can be crashy, but the reader has been comparatively stable in my not too extensive testing and renders ebooks very well.
Foliate is available in <a href="https://www.flathub.org/apps/details/com.github.johnfactotum.Foliate">Flathub</a>, in Arch Linux ARM and Fedora.</p>
<h3 id="special-email">Special: Email</h3>
<p>Getting an Email client to run and scale properly was hard on the Phosh based distributions for a long time. <a href="https://wiki.gnome.org/Apps/Geary">Geary</a>, being the modern GNOME app it is, seemed to be the obvious choice for a long time. I eventually read that <a href="https://wiki.gnome.org/Apps/Evolution/">Evolution</a> would work ok after adjusting it a bit, and that on postmarketOS, and given some adjustments it can be quite usable after a <code>scale-to-fit evolution on</code>, as long as you only use it with one mail account and don't have to many subfolders. You just have to disable all the sidebars and set the mail preview part to show up below the list of received mails. As Evolution supports GPG, you can use it for encrypted mail, too — I did not get around to trying this yet.
Evolution is packaged in every Phosh based distribution I tried so far — and it is available on <a href="https://flathub.org/apps/details/org.gnome.Evolution">Flathub</a>.</p>
<p>However, on the evening of writing this, I tried Mobian again, and guess what: Geary has been optimized and scales properly now. Why I could not setup a GMail account, a regular IMAP account of mine worked just fine. I am sure that other distributions will follow eventually.
Geary is packaged in every distribution with Phosh I tried, too. It also is available on <a href="https://flathub.org/apps/details/org.gnome.Geary">Flathub</a>.</p>
<h3 id="screenshots">Screenshots</h3>
<h4 id="newsflash">NewsFlash</h4>
<h5 id="newsflash-wrong-scaling">NewsFlash: Wrong scaling</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_wrong_scale.png" alt="NewsFlash: Wrong scaling" /></p>
<h5 id="newsflash-after-scale-to-fit">NewsFlash: After scale-to-fit</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_scale-to-fit.png" alt="NewsFlash: After scale-to-fit" /></p>
<h5 id="newsflash-sign-in">NewsFlash: Sign in</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_signin.png" alt="NewsFlash: Sign in" /></p>
<h5 id="newsflash-list-of-posts">NewsFlash: List of posts</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_postlist.png" alt="NewsFlash: List of posts" /></p>
<h5 id="newsflash-post-view-feed-with-excerpts-only">NewsFlash: Post view (feed with excerpts only)</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_post_excerpt.png" alt="NewsFlash: Post view (feed with excerpts only)" /></p>
<h5 id="newsflash-post-view-full-feed">NewsFlash: Post view (full feed)</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/newsflash_post_full.png" alt="NewsFlash: Post view (full feed)" /></p>
<h4 id="read-it-later">Read It Later</h4>
<h5 id="read-it-later-start-sign-up-screen">Read It Later: Start/sign up screen</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_start_signup.png" alt="Read It Later: Start/sign up screen" /></p>
<h5 id="read-it-later-loading">Read It Later: Loading...</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_loading.png" alt="Read It Later: Loading..." /></p>
<h5 id="read-it-later-list-of-posts">Read It Later: List of posts</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_postlist.png" alt="Read It Later: List of posts" /></p>
<h5 id="read-it-later-post-view">Read It Later: Post view</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_post.png" alt="Read It Later: Post view" /></p>
<h5 id="read-it-later-post-menu-options">Read It Later: Post, Menu options</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_post_menu.png" alt="Read It Later: Post, Menu options" /></p>
<h5 id="read-it-later-setting-screen">Read It Later: Setting screen</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_setting.png" alt="Read It Later: Setting screen" /></p>
<h5 id="read-it-later-dark-mode">Read It Later: Dark Mode</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/readitlater_darkmode.png" alt="Read It Later: Dark Mode" /></p>
<h4 id="foliate">Foliate</h4>
<h5 id="foliate-start-screen">Foliate: Start screen</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/foliate_start.png" alt="Foliate: Start screen" /></p>
<h5 id="foliate-catalogue">Foliate: Catalogue</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/foliate_catalogue.png" alt="Foliate: Catalogue" /></p>
<h5 id="foliate-catalogue-single-book-view">Foliate: Catalogue: Single Book View</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/foliate_catalogue_single_book.png" alt="Foliate: Catalogue: Single Book View" /></p>
<h5 id="foliate-reading-mode-book-title-page">Foliate: Reading Mode: Book Title page</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/foliate_book_title.png" alt="Foliate: Reading Mode: Book Title page" /></p>
<h5 id="foliate-reading-mode-book-chapter">Foliate: Reading Mode: Book Chapter</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/foliate_book_chapter1.png" alt="Foliate: Reading Mode: Book Chapter" /></p>
<h4 id="geary">Geary</h4>
<h5 id="geary-add-account">Geary: Add account</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/geary_add_account.png" alt="Geary: Add account" /></p>
<h5 id="geary-list-view">Geary: List view</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/geary_mail_list.png" alt="Geary: List view" /></p>
<h5 id="geary-mail-view">Geary: Mail view</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/geary_mail.png" alt="Geary: Mail view" /></p>
<h4 id="evolution">Evolution</h4>
<h5 id="evolution-view-settings-1">Evolution: View Settings 1</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/evolution_setting1.png" alt="Evolution: View Settings 1" /></p>
<h5 id="evolution-view-settings-2">Evolution: View Settings 2</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/evolution_setting2.png" alt="Evolution: View Settings 2" /></p>
<h5 id="evolution-mail-view">Evolution: Mail View</h5>
<p><img src="https://linmob.net/pinephone-daily-driver-challenge-part3-reading-apps-and-email/evolution_mailview.png" alt="Evolution: Mail View" /></p>
PinePhone DDC pt. 2: Flatpaks and Scaling2020-07-27T05:33:18+00:002022-05-29T17:17:00+00:00https://linmob.net/pinephone-daily-driver-challenge-part2-flatpak-and-scaling-in-phosh/<p>I have decided to change my approach: Writing the post before shooting the third "PinePhone as a daily driver" video. This week is going to be about Flatpak, Reading apps and the intricacies of running (non-)Flatpak Qt and GTK apps on the respective "other side". Part 1: Flatpak and Scaling in Phosh.</p>
<span id="continue-reading"></span>
<p><strong>Caveat:</strong> <em>For the past week I have been struggling with receiving calls on Phosh/ModemManager based distributions, approximately since the massive improvements in battery life due to new Crust firmware. I found another user suffering from this issue, but assuming my tweets are being read among PinePhone users, it does not seem to be a widespread problem. I am continuing with this series despite of these issues, but be aware that core functionality might be currently not available.</em></p>
<h3 id="flatpaks-across-pinephone-distributions">Flatpaks across PinePhone distributions</h3>
<p>As many of the apps I will discuss later on are first and foremosts available as Flatpaks, let's dive into tutorial territory on how to install flatpaks.
The first part of this is specific for your distribution:</p>
<h4 id="postmarketos">postmarketOS</h4>
<p><em>I switched my eMMC OS to postmarketOS this week, using one of their images that include their installer.</em>
If you are using <em>Phosh</em>, get Flatpak support by typing
<code>sudo apk add gnome-software-plugin-flatpak</code>,
if you insist on running <em>Plasma Mobile</em> despite its early state run
<code>sudo apk add discover-backend-flatpak</code> instead. If you don't want Flatpak in your software center or you are among those, that just run another window manager, e.g. <em>sway</em>, just run
<code>sudo apk add flatpak</code>.</p>
<h4 id="arch-and-manjaro">Arch and Manjaro</h4>
<p><code>sudo pacman -Syu flatpak</code> gets you bare minimum <em>flatpak</em> support here. Arch does not come with sudo enabled by default, therefore a <code>su</code> and then a <code>pacman -Syu flatpak</code> should get the job done.</p>
<h4 id="mobian-pureos-port">Mobian / PureOS port</h4>
<p><code>sudo apt install flatpak</code> for basic flatpak support, and <code>sudo apt install gnome-software-plugin-flatpak</code> (which depends on flatpak, so running this should be enough) gets you Flatpak support in Gnome Software Center.</p>
<h4 id="enabling-flathub">Enabling Flathub</h4>
<p>Just having Flatpak does not help you much. <a href="https://flathub.org">Flathub</a> contains many mobile optimized and other apps, that may work with <code>scale-to-fit</code>. Just run <code>sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo</code> (or without the sudo, if you are root) and you will have Flathub and all its software available for installation.
If you want to install the software from the <em>Gnome Software Center</em> or <em>Discover</em>, and it does not work yet, try a reboot.</p>
<h4 id="enabling-other-flathub-repositories-e-g-kde-apps">Enabling other Flathub repositories, e.g. KDE Apps</h4>
<p>Just run <code>flatpak remote-add --if-not-exists kdeapps --from https://distribute.kde.org/kdeapps.flatpakrepo</code> as root. </p>
<h4 id="tradeoffs-of-using-flatpak-apps">Tradeoffs of using flatpak apps</h4>
<p>Flatpaks have caused some controversy in the Linux community, and their security model has been <a href="http://flatkill.org/">questioned</a>. These quarrels aside, you need to know that using just a few Flatpaks will take <em>a ton of disk space on your phone</em>, as all the foundations for the app will be loaded with them — just don't use them on a 4GB or 8GB SDHC card. Also, as the base flatpaks need to be downloaded and updated, you should have enough bandwith. Unless your mobile data plan is truly unlimited, download them over a non-metered connection.</p>
<h4 id="installing-flatpaks">Installing Flatpaks</h4>
<p>Now that you have been warned, installing Flatpaks is simple. You can do so from <em>Gnome Software</em> or <em>Discover</em>, or just by running <code>flatpak install appname</code>. You do not need to know the exact name, <code>flatpak</code> will figure it out and let you choose between options, if there is more than one Flatpak matching your query. Just try it, it's simple!</p>
<h5 id="exercise-installing-the-cawbird-twitter-client">Exercise: Installing the Cawbird twitter client</h5>
<p><a href="https://github.com/IBBoard/cawbird">Cawbird</a> is a nice GTK-based Twitter client, that works on the PinePhone, but does not scale perfectly by default.
Type <code>flatpak install cawbird</code> and hit Enter</p>
<pre><code>Looking for matches…
Found similar ref(s) for ‘cawbird’ in remote ‘flathub’ (system).
Use this remote? [Y/n]:
Found ref ‘app/uk.co.ibboard.cawbird/aarch64/stable’ in remote ‘flathub’ (system).
Use this ref? [Y/n]:
</code></pre>
<p>It really is simple, you just have to read and press Enter if you agree.</p>
<h4 id="managing-space">Managing space</h4>
<p>While installing multiple apps that use the same set of base runtimes reduces the space of your installed flatpak apps when calculated per app, the space these flatpaks use may increase over time. To make sure you're not wasting too much of your precious disk space (or when you are getting warnings that your filesystem is almost at capacity), do run <code>flatpak repair</code> (in case of system-wide installed flatpaks make sure to run it with elevated permissions (as root or with <code>sudo</code>)). It might reduce the space installed flatpaks occupy on your system by quite a bit - it once freed 5 gigabytes on my Librem 5.</p>
<h3 id="manual-scaling-in-phosh">Manual Scaling in Phosh</h3>
<p>Now that we have installed an app, it may happen that it does not scale correctly. Cawbird is one of these apps that almost works out of the box and after telling Phosh to scale it properly, is just fine.</p>
<p>Newer Phosh distributions come with a command called <code>scale-to-fit</code>. It's used like this: <code>$ scale-to-fit <APP-ID> on</code>. For Cawbird it is simple: Just <code>$ scale-to-fit cawbird on</code>, as is documented on the Mobian Wiki. But let's assume we did not know it — and you will eventually run into this — how can we simply find out the APP-ID?</p>
<p>The method on the Mobian Wiki works, but it is clunky. Yesterday I scrolled through the blog of Phoshs main developer/release manager, and took what I found there to come up with the following simple bash-script:</p>
<pre><code>#!/bin/bash
WAYLAND_DEBUG=1 $1 |& grep 'xdg_toplevel@[0-9]\+\.set_app_id'
</code></pre>
<p>Just copy these two lines into a text file, e.g. named <code>get-app-id.sh</code>, on your PinePhone and make it executable by running <code>$ chmod +x get-app-id.sh</code>.</p>
<p>Let's say, you want to use KeePassXC, which does not scale well, but becomes somewhat usable by running <code>scale-to-fit</code>. But you won't get there by running <code>$ scale-to-fit keepassxc on</code>. You can now run <code>$ ./get-app-id.sh keepassxc</code> and <em>KeePassXC</em> will start up. Go back to your terminal and you will find a line of text similar to:</p>
<pre><code>[4049990.198] -> xdg_toplevel@21.set_app_id("org.keepassxc.KeePassXC")
</code></pre>
<p>The part between the "" is what you are looking for. Just run <code>$ scale-to-fit org.keepassxc.KeePassXC</code> and the next time you start KeePassXC, it should be usable.</p>
<p>The same works for Flatpak apps. You will just need to find out the Flatpaks Application ID, which is possible by performing <code>$ flatpak search ...</code>, or for Flathub apps by just looking at the flathub.org webpage for the specific app you want to adjust, e.g. <code>https://flathub.org/apps/details/uk.co.ibboard.cawbird</code>, where <em>uk.co.ibboard.cawbird</em> is what you need.</p>
<p>Now you can just run a <code>$ ./get-app-id.sh "flatpak run uk.co.ibboard.cawbird"</code> and that will return the APP-ID you are looking for:</p>
<pre><code>[536137.138] -> xdg_toplevel@29.set_app_id("cawbird")
</code></pre>
<p><em>Easy, huh? I hope this post was helpful, if you have questions, just contact me on <a href="https://twitter.com/linmobblog">Twitter</a>, <a href="https://fosstodon.org/@linmob">Mastodon</a> or via e-mail.</em></p>
<p><strong>Addition (07/27/2020, 8:14pm CEST):</strong> There is another way to get the APP-ID that <a href="https://twitter.com/dos1/status/1287569070045507587">has been pointed out to me by Twitter user @dos1</a>:</p>
<blockquote>
<p>Compile <code>examples/foreign-toplevel.c</code> from wlroots source tree and you'll get a tool that lists you app-ids of open windows :P</p>
</blockquote>
<p>This approach requires more effort once and then a lot less effort going forward. <em>Choose wisely!</em></p>