Difference between revisions of "Plasma Mobile"

From postmarketOS
Jump to navigation Jump to search
(Migrate from https://github.com/postmarketOS/pmbootstrap/wiki)
 
m (Fixed a few links and improved formatting)
 
(85 intermediate revisions by 18 users not shown)
Line 1: Line 1:
== Overview ==
+
{{Infobox interface
 +
| name = Plasma Mobile
 +
| image = File:Plasma Mobile homescreen.png
 +
| imagecaption = Plasma Mobile homescreen.
 +
| graphics = KWin on Wayland
 +
| toolkit = Qt 5
 +
}}
  
The basic minimum shell has been ported to postmarketOS, and can now be tested. So far no one has gotten it working yet, so don't expect anything but errors.
+
A mobile variant of the KDE Plasma [[:Category:Interface|user interface]], optimized for touchscreen.
  
To install it on your device run <code>./pmbootstrap.py install --add plasma-mobile,plasma-phone-components,dbus-x11</code>. You can also tell pmbootstrap to ''always'' add Plasma Mobile by adding <code>plasma-mobile</code>, <code>plasma-phone-components</code> and <code>dbus-x11</code> to the list of &quot;Extra packages&quot; when running <code>./pmbootstrap.py init</code>.
+
= Installation =
 +
Use the pre-built images from the downloads section of [https://postmarketos.org postmarketos.org], or build your own image with [[pmbootstrap]]. If using the latter, Plasma Mobile can be installed by selecting it as the UI in <code>pmbootstrap init</code>.
  
For instructions on running Plasma Mobile you can use the KDE website: https://community.kde.org/Plasma/Mobile/RunningApps
+
On existing systems, it can be installed by installing the <code>postmarketos-ui-plasma-mobile</code> meta package or <code>plasma-phone-components</code> if postmarketOS specific customization is not wanted.
  
''Packaging efforts have been documented [[here|Packaging Plasma Mobile]].''
+
When running <code>pmbootstrap install</code> you'll be prompted for a user password. Make sure to only use numeric characters [0-9] in this password as the Plasma Mobile lock screen uses this password as a PIN. On an existing Plasma Mobile install you can change your user password and PIN in the Terminal with the standard <code>passwd</code> command.
  
== Debugging ==
+
[[File:Postmarketos-pinephone-plasma-mobile-v21.03.jpg|250px|thumb|postmarketOS v21.03 with Plasma Mobile on the PinePhone]]
  
Create <code>~/.config/QtProject/qtlogging.ini</code> with the following content:
+
= Usage =
 +
== First Boot ==
 +
{{note|If you get stuck, head over to [[Matrix and IRC|Matrix and IRC chats]]. [[How_to_report_issues|Report issues]].}}
 +
As with all other interfaces in postmarketOS, the first boot takes longer than usual: the file system will be resized to use the entire device.
  
<pre>[Rules]
+
After boot, you are asked for your PIN. For pre-built images, this is <code>147147</code>.
org.kde.kwindowsystem.info=true
 
org.kde.kwindowsystem.warning=true
 
org.kde.kwindowsystem.critical=true
 
org.kde.kwindowsystem.debug=true
 
kwin_core.info=true
 
kwin_core.warning=true
 
kwin_core.critical=true
 
kwin_core.debug=true
 
kwineffects.info=true
 
kwineffects.warning=true
 
kwineffects.critical=true
 
kwineffects.debug=true
 
libkwineffects.info=true
 
libkwineffects.warning=true
 
libkwineffects.critical=true
 
libkwineffects.debug=true
 
libkwinglutils.info=true
 
libkwinglutils.warning=true
 
libkwinglutils.critical=true
 
libkwinglutils.debug=true
 
libkwinxrenderutils.info=true
 
libkwinxrenderutils.warning=true
 
libkwinxrenderutils.critical=true
 
libkwinxrenderutils.debug=true
 
kwin_wayland_drm.info=true
 
kwin_wayland_drm.warning=true
 
kwin_wayland_drm.critical=true
 
kwin_wayland_drm.debug=true
 
kwin_wayland_framebuffer.info=true
 
kwin_wayland_framebuffer.warning=true
 
kwin_wayland_framebuffer.critical=true
 
kwin_wayland_framebuffer.debug=true
 
kwin_wayland_hwcomposer.debug=true
 
kwin_wayland_backend.info=true
 
kwin_wayland_backend.warning=true
 
kwin_wayland_backend.critical=true
 
kwin_wayland_backend.debug=true
 
kwin_wayland_x11windowed.info=true
 
kwin_wayland_x11windowed.warning=true
 
kwin_wayland_x11windowed.critical=true
 
kwin_wayland_x11windowed.debug=true
 
kwin_platform_x11_standalone.info=true
 
kwin_platform_x11_standalone.warning=true
 
kwin_platform_x11_standalone.critical=true
 
kwin_platform_x11_standalone.debug=true
 
kwin_libinput.info=true
 
kwin_libinput.warning=true
 
kwin_libinput.critical=true
 
kwin_libinput.debug=true
 
kwin_tabbox.info=true
 
kwin_tabbox.warning=true
 
kwin_tabbox.critical=true
 
kwin_tabbox.debug=true
 
kwin_decorations.info=true
 
kwin_decorations.warning=true
 
kwin_decorations.critical=true
 
kwin_decorations.debug=true
 
kwin_scripting.info=true
 
kwin_scripting.warning=true
 
kwin_scripting.critical=true
 
kwin_scripting.debug=true
 
kwin_xkbcommon.info=true
 
kwin_xkbcommon.warning=true
 
kwin_xkbcommon.critical=true
 
kwin_xkbcommon.debug=true
 
kwin_qpa_plugin.info=true
 
kwin_qpa_plugin.warning=true
 
kwin_qpa_plugin.critical=true
 
kwin_qpa_plugin.debug=true</pre>
 
== Running ==
 
  
Setup the required environment variables for kwin:
+
== Connect to Wi-Fi ==
 +
Swipe the top bar down to reveal a menu with a Wifi symbol. Tapping the symbol itself will turn Wifi on or off. To connect to a network the first time, tap the Wifi word below the symbol (the one with the small down arrow next to it). Now select an access point.
  
<pre>export QT_QPA_PLATFORM=wayland
+
=== Wi-Fi kwallet bug for images before 2021-04-01 ===
 +
When connecting to an access point with a password, due to {{issue|1037|pmaports}}, you are required to set a kwallet password, and unfortunately the dialog is a bit awkward to navigate. Type in a password, then click the visibility button to show the password, and click OK to set it. You will be asked for this password after rebooting the phone and trying to connect to Wi-Fi again.
 +
 
 +
Images from 2021-04-01 onwards will have the kwallet bug fixed. If you have installed an image before, run the following commands over [[SSH]] after successfully connecting to Wi-Fi:
 +
 
 +
<syntaxhighlight lang="shell-session">
 +
# apk update
 +
# apk upgrade -a
 +
$ mv ~/.local/share/kwalletd ~/.local/share/kwalletd_backup
 +
$ mkdir -p ~/.local/share/kwalletd
 +
$ cd ~/.local/share/kwalletd
 +
# cp /etc/skel/.local/share/kwalletd/kdewallet.kwl .
 +
# cp /etc/skel/.local/share/kwalletd/kdewallet.salt .
 +
# chown <your user>:<your user> kdewallet.*
 +
</syntaxhighlight>
 +
 
 +
== Install Updates ==
 +
Go to the Home Screen (tap the bottom right X if you have an application open). Swipe from the bottom upwards to reveal the app menu and start Discover, KDE's graphical package manager frontend. When Discover asks for privileges ({{issue|1036|pmaports}}), type in your user's PIN (e.g. <code>147147</code> for pre-built images).
 +
 
 +
Swipe from the left to center to open Discover's menu, and select the entry with the up-arrow at the very bottom (it may say "Fetching updates" or the number of updates available). From here you can perform the updates. Depending on what has been updated, you need to reboot the device afterwards for changes to take effect.
 +
 
 +
== Running Apps from SSH session ==
 +
In order to run applications on the device, you need to set up your environment similar to the environment in which the plasmashell is running:
 +
 
 +
<syntaxhighlight lang="shell">
 +
export $(cat /proc/$(pidof plasmashell)/environ | tr '\0' '\n')
 +
</syntaxhighlight>
 +
 
 +
For the official KDE instructions on running Plasma Mobile, see https://develop.kde.org/docs/plasma-mobile/running-apps/.
 +
 
 +
== Taking screenshots ==
 +
In command line:
 +
 
 +
<syntaxhighlight lang="shell">
 +
qdbus org.kde.KWin /Screenshot org.kde.kwin.Screenshot.screenshotArea 0 0 1080 1920
 +
</syntaxhighlight>
 +
 
 +
<code>qdbus-qt5</code> is from package <code>qt5-qttools</code>.
 +
 
 +
== Power Off and Reboot ==
 +
Hold the power button for about three seconds, then let go. Do not hold it too long, or else you will force-reboot your device. You will be presented with the options to reboot, power off or cancel. [https://invent.kde.org/plasma/plasma-mobile/-/issues/71 plasma-phone#71] is about making this a bit more intuitive.
 +
 
 +
= Troubleshooting =
 +
== Scaling ==
 +
On devices such as the [[Samsung_Galaxy_A5_2015_(samsung-a5ulte)]], [[Samsung_Galaxy_A3_2015_(samsung-a3)]], [[BQ Aquaris X5 (bq-paella)]] or [[Moto_G4_Play_(motorola-harpia)]], you may need to set a custom scaling factor.
 +
 
 +
The following sets a 2x scale factor:
 +
 
 +
<syntaxhighlight lang="shell">
 +
kscreen-doctor output.1.scale.2
 +
</syntaxhighlight>
 +
 
 +
If you're trying to run this from SSH session, you need to set extra env vars:
 +
 
 +
<syntaxhighlight lang="shell">
 +
XDG_RUNTIME_DIR=/run/user/10000 QT_QPA_PLATFORM=wayland kscreen-doctor output.1.scale.2
 +
</syntaxhighlight>
 +
 
 +
== Log output ==
 +
Logs are written to <code>~/.cache/tinydm.log</code>.
 +
 
 +
== Logging isn't verbose ==
 +
One needs to enable debug logging for certain components in <code>~/.config/QtProject/qtlogging.ini</code>. Without that, you barely see any log output. We [https://github.com/postmarketOS/pmbootstrap/blob/917f03d5f9f015fa9fc0be8093d87b7f21d98d4a/aports/main/postmarketos-ui-plasma-mobile/APKBUILD#L27 ship such a qtlogging.ini file] in <code>postmarketos-ui-plasma-mobile</code> because Plasma Mobile is relatively new and we want to be able to debug it properly.
 +
 
 +
If the file did not get installed for you, please double check if it is there and report in {{issue|1038}}.
 +
 
 +
== KWin doesn't work ==
 +
{{note|Plasma Mobile shell uses some Wayland protocols, so you can't run it on X11 in case you tried to do that.}}
 +
Please follow [https://blog.martin-graesslin.com/blog/2016/07/why-does-kwin_wayland-not-start/ these instructions] for debugging.
 +
 
 +
== Some env vars that may help Angelfish browser ==
 +
<syntaxhighlight lang="bash">
 +
# Recommended in https://bugreports.qt.io/browse/QTBUG-80665
 +
export QTWEBENGINE_DISABLE_GPU_THREAD=1
 +
# Flags are based on workaround for SFOS (disable-gpu-compositing) and default Android settings:
 +
# Multiple Raster Threads: Disabled
 +
# Flags enabled by Qt if enable-embedded-switches is given
 +
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu-compositing --num-raster-threads=1 --enable-viewport --disable-composited-antialiasing"
 +
</syntaxhighlight>
 +
( [https://github.com/sailfishos-flatpak/flatpak-runner/blob/a49f60f3347972eb673fc35b94c4ef1c2024297d/src/appsettings.cpp#L79 source] )
 +
 
 +
== Software rendering ==
 +
{{note|Famebuffer backend for KWin [https://invent.kde.org/plasma/kwin/-/merge_requests/1906 is now] [https://invent.kde.org/plasma/kwin/-/commit/994c5c24ae4857dea40c4068a34a38f210323219 dropped], so this section will no longer work, presumably since plasma-5.25}}
 +
 
 +
Plasma can also be used if your device doesn't support hardware acceleration (if it's a non-armhf device) yet by using software rendering. Please note that the interface will be slow, and it might not be usable for the average user.
 +
 
 +
Software rendering is not enabled automatically for now. Make sure <code>mesa-dri-gallium</code> is installed (it contains swrast dri module).
 +
 
 +
Edit KWin wrapper startup script:
 +
 
 +
<syntaxhighlight lang="shell-session">
 +
# nano /usr/bin/kwinwrapper
 +
</syntaxhighlight>
 +
 
 +
Comment out existing startplasma invocation command at the end of file and replace it with
 +
 
 +
<syntaxhighlight lang="shell">
 +
export KWIN_COMPOSE=QPainter
 +
export GALLIUM_DRIVER=softpipe
 +
export LIBGL_ALWAYS_SOFTWARE=1
 +
 
 +
startplasma-wayland \
 +
        --framebuffer \
 +
        --xwayland \
 +
        --libinput \
 +
        --inputmethod maliit-server \
 +
        --exit-with-session=/usr/lib/libexec/startplasma-waylandsession
 +
</syntaxhighlight>
 +
 
 +
Then restart tinydm
 +
 
 +
<syntaxhighlight lang="shell-session">
 +
# rc-service tinydm restart
 +
</syntaxhighlight>
 +
 
 +
You can alternatively try this script to run e.g. <code>plasma-desktop</code> on X11
 +
 
 +
<syntaxhighlight lang="shell">
 +
#!/bin/sh
 +
 
 +
export KWIN_COMPOSE=QPainter
 +
export GALLIUM_DRIVER=llvmpipe
 +
export LIBGL_ALWAYS_SOFTWARE=1
 +
export QSG_RENDER_LOOP=basic
 +
export KIRIGAMI_LOWPOWER_HARDWARE=1
 +
 
 +
startx /usr/bin/startplasma-x11
 +
</syntaxhighlight>
 +
 
 +
== Starting Plasma Mobile from the Terminal ==
 +
If <code>postmarketos-ui-plasma-mobile</code> is installed, Plasma Mobile will be automatically launched via tinydm.
 +
 
 +
It can also be launched manually by running the following script:
 +
 
 +
<syntaxhighlight lang="shell">
 +
#!/bin/sh
 +
 
 +
export QML2_IMPORT_PATH=/usr/lib/qt/qml:/usr/lib/qt5/qml
 
export QT_QPA_PLATFORMTHEME=KDE
 
export QT_QPA_PLATFORMTHEME=KDE
 +
export QT_QUICK_CONTROLS_STYLE=Plasma
 
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
 
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
 
export XDG_CURRENT_DESKTOP=KDE
 
export XDG_CURRENT_DESKTOP=KDE
export KSCREEN_BACKEND=QScreen
 
 
export KDE_FULL_SESSION=1
 
 
export KDE_SESSION_VERSION=5
 
export KDE_SESSION_VERSION=5
export KWIN_COMPOSE=Q
+
export PLASMA_PLATFORM=phone:handset
 +
export QT_VIRTUALKEYBOARD_STYLE=Plasma
 +
export QT_QUICK_CONTROLS_MOBILE=true
 +
export QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
 +
sleep 2
  
export $(dbus-launch)</pre>
+
if [ -d "/dev/dri" ]; then
Right now kwin fails due to lacking permissions on <code>/dev/fb0</code>, so as a workaround you can chown it to your user.
+
kwin_wayland --drm --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
 +
else
 +
# NOTE: using GALLIUM_DRIVER=llvmpipe might give you better performance (or not work at all.)
 +
# see: https://gitlab.com/postmarketOS/pmaports/-/issues/852
 +
export GALLIUM_DRIVER=softpipe
 +
export KWIN_COMPOSE=Q
 +
export LIBGL_ALWAYS_SOFTWARE=1
  
<pre># chown user:user /dev/fb0</pre>
+
echo "startplasmamobile: using software rendering with: ${GALLIUM_DRIVER}" | logger -t "$(whoami):plasma-mobile"
On devices without OpenGL support (like Qemu right now), it's required to tell kwin to run in software rendering mode. Add the following to <code>~/.config/kdeglobals</code>:
+
kwin_wayland --framebuffer --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
 +
fi
 +
</syntaxhighlight>
  
<pre>[QtQuickRendererSettings]
+
== Flickering in Mozilla Firefox ==
SceneGraphBackend=software</pre>
+
In case you experience flickering with the Mozilla Firefox web browser, it is because of [https://bugs.kde.org/show_bug.cgi?id=424586 a rendering bug in the browser], and can be mitigated by switching to the WebRenderer rendering backend by setting <code>gfx.webrender.all</code> to <code>true</code> in the browser's <code>about:config</code> window.
Then execute <code>ck-launch-session kwin_wayland --framebuffer --xwayland</code>. As this way you can not view the logs, it's advisable to add <code>2&gt; kwin_log.txt</code> to the end of the command, so it ends up looking like <code>ck-launch-session kwin_wayland --framebuffer --xwayland 2&gt; kwin_log.txt</code>. This will make it log to kwin_log.txt instead of stdout.
+
[[Category:Interface]]

Latest revision as of 02:21, 27 July 2022

Plasma Mobile
Plasma Mobile homescreen.
Plasma Mobile homescreen.
Name Plasma Mobile
Graphics stack KWin on Wayland
Toolkit Qt 5
In postmarketOS
Package postmarketos-ui-plasma-mobile
Status Available

A mobile variant of the KDE Plasma user interface, optimized for touchscreen.

Installation

Use the pre-built images from the downloads section of postmarketos.org, or build your own image with pmbootstrap. If using the latter, Plasma Mobile can be installed by selecting it as the UI in pmbootstrap init.

On existing systems, it can be installed by installing the postmarketos-ui-plasma-mobile meta package or plasma-phone-components if postmarketOS specific customization is not wanted.

When running pmbootstrap install you'll be prompted for a user password. Make sure to only use numeric characters [0-9] in this password as the Plasma Mobile lock screen uses this password as a PIN. On an existing Plasma Mobile install you can change your user password and PIN in the Terminal with the standard passwd command.

postmarketOS v21.03 with Plasma Mobile on the PinePhone

Usage

First Boot

Note If you get stuck, head over to Matrix and IRC chats. Report issues.

As with all other interfaces in postmarketOS, the first boot takes longer than usual: the file system will be resized to use the entire device.

After boot, you are asked for your PIN. For pre-built images, this is 147147.

Connect to Wi-Fi

Swipe the top bar down to reveal a menu with a Wifi symbol. Tapping the symbol itself will turn Wifi on or off. To connect to a network the first time, tap the Wifi word below the symbol (the one with the small down arrow next to it). Now select an access point.

Wi-Fi kwallet bug for images before 2021-04-01

When connecting to an access point with a password, due to pmaports#1037, you are required to set a kwallet password, and unfortunately the dialog is a bit awkward to navigate. Type in a password, then click the visibility button to show the password, and click OK to set it. You will be asked for this password after rebooting the phone and trying to connect to Wi-Fi again.

Images from 2021-04-01 onwards will have the kwallet bug fixed. If you have installed an image before, run the following commands over SSH after successfully connecting to Wi-Fi:

# apk update
# apk upgrade -a
$ mv ~/.local/share/kwalletd ~/.local/share/kwalletd_backup
$ mkdir -p ~/.local/share/kwalletd
$ cd ~/.local/share/kwalletd
# cp /etc/skel/.local/share/kwalletd/kdewallet.kwl .
# cp /etc/skel/.local/share/kwalletd/kdewallet.salt .
# chown <your user>:<your user> kdewallet.*

Install Updates

Go to the Home Screen (tap the bottom right X if you have an application open). Swipe from the bottom upwards to reveal the app menu and start Discover, KDE's graphical package manager frontend. When Discover asks for privileges (pmaports#1036), type in your user's PIN (e.g. 147147 for pre-built images).

Swipe from the left to center to open Discover's menu, and select the entry with the up-arrow at the very bottom (it may say "Fetching updates" or the number of updates available). From here you can perform the updates. Depending on what has been updated, you need to reboot the device afterwards for changes to take effect.

Running Apps from SSH session

In order to run applications on the device, you need to set up your environment similar to the environment in which the plasmashell is running:

export $(cat /proc/$(pidof plasmashell)/environ | tr '\0' '\n')

For the official KDE instructions on running Plasma Mobile, see https://develop.kde.org/docs/plasma-mobile/running-apps/.

Taking screenshots

In command line:

qdbus org.kde.KWin /Screenshot org.kde.kwin.Screenshot.screenshotArea 0 0 1080 1920

qdbus-qt5 is from package qt5-qttools.

Power Off and Reboot

Hold the power button for about three seconds, then let go. Do not hold it too long, or else you will force-reboot your device. You will be presented with the options to reboot, power off or cancel. plasma-phone#71 is about making this a bit more intuitive.

Troubleshooting

Scaling

On devices such as the Samsung_Galaxy_A5_2015_(samsung-a5ulte), Samsung_Galaxy_A3_2015_(samsung-a3), BQ Aquaris X5 (bq-paella) or Moto_G4_Play_(motorola-harpia), you may need to set a custom scaling factor.

The following sets a 2x scale factor:

kscreen-doctor output.1.scale.2

If you're trying to run this from SSH session, you need to set extra env vars:

XDG_RUNTIME_DIR=/run/user/10000 QT_QPA_PLATFORM=wayland kscreen-doctor output.1.scale.2

Log output

Logs are written to ~/.cache/tinydm.log.

Logging isn't verbose

One needs to enable debug logging for certain components in ~/.config/QtProject/qtlogging.ini. Without that, you barely see any log output. We ship such a qtlogging.ini file in postmarketos-ui-plasma-mobile because Plasma Mobile is relatively new and we want to be able to debug it properly.

If the file did not get installed for you, please double check if it is there and report in #1038.

KWin doesn't work

Note Plasma Mobile shell uses some Wayland protocols, so you can't run it on X11 in case you tried to do that.

Please follow these instructions for debugging.

Some env vars that may help Angelfish browser

# Recommended in https://bugreports.qt.io/browse/QTBUG-80665
export QTWEBENGINE_DISABLE_GPU_THREAD=1
# Flags are based on workaround for SFOS (disable-gpu-compositing) and default Android settings:
# Multiple Raster Threads: Disabled
# Flags enabled by Qt if enable-embedded-switches is given
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu-compositing --num-raster-threads=1 --enable-viewport --disable-composited-antialiasing"

( source )

Software rendering

Note Famebuffer backend for KWin is now dropped, so this section will no longer work, presumably since plasma-5.25

Plasma can also be used if your device doesn't support hardware acceleration (if it's a non-armhf device) yet by using software rendering. Please note that the interface will be slow, and it might not be usable for the average user.

Software rendering is not enabled automatically for now. Make sure mesa-dri-gallium is installed (it contains swrast dri module).

Edit KWin wrapper startup script:

# nano /usr/bin/kwinwrapper

Comment out existing startplasma invocation command at the end of file and replace it with

export KWIN_COMPOSE=QPainter
export GALLIUM_DRIVER=softpipe
export LIBGL_ALWAYS_SOFTWARE=1

startplasma-wayland \
        --framebuffer \
        --xwayland \
        --libinput \
        --inputmethod maliit-server \
        --exit-with-session=/usr/lib/libexec/startplasma-waylandsession

Then restart tinydm

# rc-service tinydm restart

You can alternatively try this script to run e.g. plasma-desktop on X11

#!/bin/sh

export KWIN_COMPOSE=QPainter
export GALLIUM_DRIVER=llvmpipe
export LIBGL_ALWAYS_SOFTWARE=1
export QSG_RENDER_LOOP=basic
export KIRIGAMI_LOWPOWER_HARDWARE=1

startx /usr/bin/startplasma-x11

Starting Plasma Mobile from the Terminal

If postmarketos-ui-plasma-mobile is installed, Plasma Mobile will be automatically launched via tinydm.

It can also be launched manually by running the following script:

#!/bin/sh

export QML2_IMPORT_PATH=/usr/lib/qt/qml:/usr/lib/qt5/qml
export QT_QPA_PLATFORMTHEME=KDE
export QT_QUICK_CONTROLS_STYLE=Plasma
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export XDG_CURRENT_DESKTOP=KDE
export KDE_SESSION_VERSION=5
export PLASMA_PLATFORM=phone:handset
export QT_VIRTUALKEYBOARD_STYLE=Plasma
export QT_QUICK_CONTROLS_MOBILE=true
export QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
sleep 2

if [ -d "/dev/dri" ]; then
	kwin_wayland --drm --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
else
	# NOTE: using GALLIUM_DRIVER=llvmpipe might give you better performance (or not work at all.)
	# see: https://gitlab.com/postmarketOS/pmaports/-/issues/852
	export GALLIUM_DRIVER=softpipe
	export KWIN_COMPOSE=Q
	export LIBGL_ALWAYS_SOFTWARE=1

	echo "startplasmamobile: using software rendering with: ${GALLIUM_DRIVER}" | logger -t "$(whoami):plasma-mobile"
	kwin_wayland --framebuffer --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
fi

Flickering in Mozilla Firefox

In case you experience flickering with the Mozilla Firefox web browser, it is because of a rendering bug in the browser, and can be mitigated by switching to the WebRenderer rendering backend by setting gfx.webrender.all to true in the browser's about:config window.