systemd/gnome-shell-mobile: Fix a keyboard issue causing excessive battery drain

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8798>
This commit is contained in:
Cédric Bellegarde 2026-06-12 08:24:40 +02:00 committed by The Friendly Meow (merge) Bot
parent e52b130052
commit a3a2689d5e
No known key found for this signature in database
2 changed files with 40 additions and 1 deletions

View file

@ -0,0 +1,37 @@
commit 5fd671ad3ccbcd3cd65f0e8ec1e1d1692d31bba7
Author: Cédric Bellegarde <cedric.bellegarde@adishatz.org>
Date: Thu Jun 11 16:13:12 2026 +0200
keyboard: Avoid spinning idle source when window actor is unavailable
FocusTracker defers handling of newly created windows through an
idle source and checks whether the corresponding Meta.WindowActor is
available.
The callback currently returns SOURCE_CONTINUE when
get_compositor_private() returns null. Since this is an idle source,
returning SOURCE_CONTINUE causes it to be re-scheduled on every main
loop iteration until the actor becomes available. In practice this can
result in a busy loop, with the main loop repeatedly polling without
blocking and consuming significant CPU time.
A Meta.WindowActor is normally available when the window-created signal
is emitted, so there is no reason to keep retrying from an idle
handler. Treat a missing actor as a terminal condition and remove the
source instead.
Fix #70
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 8e551b48f..16f28b3f9 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -839,7 +839,7 @@ class FocusTracker extends Signals.EventEmitter {
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
const windowActor = window.get_compositor_private();
if (!windowActor)
- return GLib.SOURCE_CONTINUE;
+ return GLib.SOURCE_REMOVE;
// We assume skip_taskbar windows are popovers
if (window.skip_taskbar) {

View file

@ -5,7 +5,7 @@ maintainer="Stefan Hansson <newbyte@postmarketos.org>"
pkgname=gnome-shell-mobile
_pkgver=48.0
pkgver=9999$_pkgver
pkgrel=3
pkgrel=4
pkgdesc="GNOME shell mobile"
url="https://wiki.gnome.org/Projects/GnomeShell"
# armhf: mutter-mobile, gjs
@ -88,6 +88,7 @@ source="gnome-shell-mobile-$_commit.tar.gz::https://gitlab.gnome.org/verdre/gnom
0003-data-Drop-org.gnome.Shell.desktop.patch
0004-data-Overhaul-systemd-units.patch
0005-windowPreview-Only-try-to-close-closable-windows.patch
0006-keyboard-Avoid-spinning-idle-source-when-window-actor-is-unavailable.patch
"
builddir="$srcdir/gnome-shell-mobile-$_commit"
options="!check" # Tests have circular dependency 'gnome-shell <-> gdm'
@ -160,4 +161,5 @@ f10643bf010135cdc2d6bc122d47d4905e6ef3cea5e7a82e44d9a5d66ec147cd85872eaf869d05c1
0f859f4c879a432cddf0127f518b95ed4f21720be6490ee96b17414cae461e5dd643d8d918376c2656a08c5537c79b069d3acf6838b5b3ea0b4f880d620ad3e7 0003-data-Drop-org.gnome.Shell.desktop.patch
413bd3cd1ba63dae79afc84a2cc1cdce7b8ea8f5457fdae7a1472ea41d0c6c93a8b66c115bd112699b72ea8b7f1050d8cda23f1259f14c7b0fd7b423a1afde35 0004-data-Overhaul-systemd-units.patch
19859a78910afe6af7e7c52a616f817051eeef2741361228eb8da41c77f5834b939cbcd4954d6b98c353d61e516fadccc1ff674ac77c854c7745f07ee8974d85 0005-windowPreview-Only-try-to-close-closable-windows.patch
df9693e0bd6ca7d8157a69b0849882958d552d28334fe4bea2e6794cc0b65c43b6c318a1b5168963fae7ea7569b78e62fdb59189da7df946f7e1e4564b0328be 0006-keyboard-Avoid-spinning-idle-source-when-window-actor-is-unavailable.patch
"