Jump to content

Plasma Mobile: Difference between revisions

From postmarketOS Wiki
Log output: update log path
modernize
Line 1: Line 1:
{{note|Plasma Mobile doesn't work on armhf due to an [https://gitlab.com/postmarketOS/pmaports/issues/75 issue with <code>qt5-qtdeclarative</code>]. If your device is actually armv7 but still runs on armhf, please change it.}}
{{Infobox interface
{{Infobox interface
| name = Plasma Mobile
| name = Plasma Mobile
| image = File:Plasma-mobile-hammerhead.jpg
| image = File:Postmarketos-pinephone-plasma-mobile-v21.03.jpg  
| imagecaption = Plasma Mobile running on LG Nexus 5 (hammerhead)
| imagecaption = postmarketOS v21.03 with Plasma Mobile on the PinePhone
| graphics = KWin on Wayland
| graphics = KWin on Wayland
| toolkit = Qt 5
| toolkit = Qt 5
Line 11: Line 9:
A mobile variant of the KDE Plasma [[User-Interfaces|user interface]], optimized for touchscreen.
A mobile variant of the KDE Plasma [[User-Interfaces|user interface]], optimized for touchscreen.


== Status ==
= 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>.


It works on most devices with a working display and with hardware acceleration. There is a (possibly outdated) script below that may allow it to start on framebuffer. Do note that this interface is unbearably slow without hardware acceleration and is not recommended for devices without it.
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.


== Installation ==
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.
Using <code>pmbootstrap</code>, Plasma Mobile can be installed by selecting it as the UI in <code>pmbootstrap init</code>.


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.
= 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.


== Starting Plasma Mobile ==
After boot, you are asked for your PIN. For pre-built images, this is <code>147147</code>.


If <code>postmarketos-ui-plasma-mobile</code> is installed, Plasma Mobile will be automatically launched via tinydm.
Due to {{issue|1035|pmaports}}, the on screen keyboard may cover the bottom buttons that you would use to switch applications. If that is the case, just swipe the keyboard down to hide it.


It can also be launched manually by running the following script:
== Connect to Wi-Fi ==
<pre>
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.
#!/bin/sh


export QML2_IMPORT_PATH=/usr/lib/qt/qml:/usr/lib/qt5/qml
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.
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
== Install Updates ==
kwin_wayland --drm --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
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 numeric PIN (e.g. <code>147147</code> for pre-built images).
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"
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.
kwin_wayland --framebuffer --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
fi
</pre>


=== Running Apps from SSH session ===
== 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:
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:


Line 68: Line 49:
qdbus-qt5 is from package qt5-qttools.
qdbus-qt5 is from package qt5-qttools.


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


Line 80: Line 61:
<code>XDG_RUNTIME_DIR=/run/user/10000 QT_QPA_PLATFORM=wayland kscreen-doctor output.1.scale.2</code>
<code>XDG_RUNTIME_DIR=/run/user/10000 QT_QPA_PLATFORM=wayland kscreen-doctor output.1.scale.2</code>


=== Software rendering ===
== 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 [https://gitlab.com/postmarketOS/pmbootstrap/issues/1038 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 ==
<source 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"
</source>
( [https://github.com/sailfishos-flatpak/flatpak-runner/blob/a49f60f3347972eb673fc35b94c4ef1c2024297d/src/appsettings.cpp#L79 source] )
 
== Software rendering ==
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.
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.


Line 104: Line 108:
  $ sudo rc-service tinydm restart
  $ sudo rc-service tinydm restart


=== Log output ===
== Starting Plasma Mobile from the Terminal ==
Logs are written to <code>~/.cache/tinydm.log</code>.


=== Logging isn't verbose ===
If <code>postmarketos-ui-plasma-mobile</code> is installed, Plasma Mobile will be automatically launched via tinydm.
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 [https://gitlab.com/postmarketOS/pmbootstrap/issues/1038 1038].
It can also be launched manually by running the following script:
<pre>
#!/bin/sh


=== KWin doesn't work ===
export QML2_IMPORT_PATH=/usr/lib/qt/qml:/usr/lib/qt5/qml
{{note|Plasma Mobile shell uses some Wayland protocols, so you can't run it on X11 in case you tried to do that.}}
export QT_QPA_PLATFORMTHEME=KDE
Please follow [https://blog.martin-graesslin.com/blog/2016/07/why-does-kwin_wayland-not-start/ these instructions] for debugging.
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


=== Some env vars that may help Angelfish browser ===
if [ -d "/dev/dri" ]; then
<source lang="bash">
kwin_wayland --drm --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
# Recommended in https://bugreports.qt.io/browse/QTBUG-80665
else
export QTWEBENGINE_DISABLE_GPU_THREAD=1
# NOTE: using GALLIUM_DRIVER=llvmpipe might give you better performance (or not work at all.)
# Flags are based on workaround for SFOS (disable-gpu-compositing) and default Android settings:
# see: https://gitlab.com/postmarketOS/pmaports/-/issues/852
# Multiple Raster Threads: Disabled
export GALLIUM_DRIVER=softpipe
# Flags enabled by Qt if enable-embedded-switches is given
export KWIN_COMPOSE=Q
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu-compositing --num-raster-threads=1 --enable-viewport --disable-composited-antialiasing"
export LIBGL_ALWAYS_SOFTWARE=1
</source>
( [https://github.com/sailfishos-flatpak/flatpak-runner/blob/a49f60f3347972eb673fc35b94c4ef1c2024297d/src/appsettings.cpp#L79 source] )


== Guide ==
echo "startplasmamobile: using software rendering with: ${GALLIUM_DRIVER}" | logger -t "$(whoami):plasma-mobile"
Follow the [https://wiki.postmarketos.org/wiki/Display Display] guide to change and fix display related issues.
kwin_wayland --framebuffer --xwayland plasma-phone 2>&1 | logger -t "$(whoami):plasma-mobile"
fi
</pre>


[[Category:Interface]]
[[Category:Interface]]

Revision as of 00:56, 31 March 2021

Plasma Mobile
postmarketOS v21.03 with Plasma Mobile on the PinePhone
postmarketOS v21.03 with Plasma Mobile on the PinePhone
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.

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.

Due to pmaports#1035, the on screen keyboard may cover the bottom buttons that you would use to switch applications. If that is the case, just swipe the keyboard down to hide it.

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.

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.

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 numeric 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 their website.

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.

Troubleshooting

Scaling

On devices such as the Samsung_Galaxy_A5_2015_(samsung-a5ulte), 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

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

$ sudo 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

$ sudo rc-service tinydm restart

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