Support Plasma 6.8 unlock prompts across screen blanking

Keep prompt visibility separate from native authentication, reapply the patch after lock-screen file updates, and retain Plasma 6.7 compatibility. Add modern patch and visibility regression tests and document Fedora 45 package support.
This commit is contained in:
ajp_anton committed 2026-11-14 02:09:04 +00:00
1 parent 851e0d1d24
commit d2a6aafc71
10 files changed
+867 -34

No files matched your search

+13 -10
View File
@@ -24,8 +24,10 @@ sudo dnf install plasma-panel-actions
## Compatibility ## Compatibility
Packages are built and tested on Fedora 44 and 45.
The primary test environment is a Framework Laptop 13 Pro running Fedora Linux The primary test environment is a Framework Laptop 13 Pro running Fedora Linux
44 on x86_64, with KDE Plasma 6.7 and a Wayland session using KWin. 44 on x86_64, with KDE Plasma 6.7–6.8 and a Wayland session using KWin.
Compatibility with other Fedora releases, desktop environments, display Compatibility with other Fedora releases, desktop environments, display
systems, architectures, or distributions may be limited. systems, architectures, or distributions may be limited.
@@ -62,15 +64,16 @@ The `plasma-always-show-unlock` package keeps Plasma's password and fingerprint
prompt visible from the moment the lock screen appears, including after the prompt visible from the moment the lock screen appears, including after the
display is turned off or the system resumes from sleep. display is turned off or the system resumes from sleep.
The package applies a narrow patch to Plasma 6.7's lock-screen QML and reapplies On Plasma 6.8 and newer, a small QML policy keeps the prompt visible while
it after `plasma-desktop` updates. An unknown future layout is left unchanged leaving authentication to Plasma. It tolerates unrelated layout changes and
instead of being modified speculatively. Removing the package restores Plasma's reapplies automatically after updates replace the lock-screen file. Unsupported
original behaviour. It retries lock-screen authentication after resume, the interfaces are left unchanged. Removing the package restores Plasma's original
automatic-lock grace period and idle fingerprint timeouts. Failed scans do not behaviour.
trigger automatic retries. It does not modify `kscreenlocker` authentication
code or restart `fprintd`; retry support depends on the installed KScreenLocker. Plasma 6.7 uses the earlier patch, including retries after resume and idle
An intermittent missing fingerprint prompt can still occur; pressing a key may fingerprint timeouts. Neither version changes `kscreenlocker` authentication
restore it. The idle retry is a workaround, not a complete fix for that issue. code or restarts `fprintd`. Fingerprint availability depends on the installed
KScreenLocker and fingerprint driver.
### Plasma task-group shortcuts ### Plasma task-group shortcuts
@@ -0,0 +1,53 @@
// SPDX-License-Identifier: MIT
import QtQml
QtObject {
id: policy
required property QtObject window
required property QtObject screen
required property QtObject idleTimer
function reveal() {
if (window && window.visible && window.active) {
if ("seenPositionChange" in screen) {
screen.seenPositionChange = true;
}
screen.uiVisible = true;
}
}
Component.onCompleted: {
idleTimer.stop();
// Wait until the lock screen has finished constructing its authenticators.
Qt.callLater(reveal);
}
onWindowChanged: Qt.callLater(reveal)
property Connections visibilityChanges: Connections {
target: policy.window
function onVisibleChanged() { Qt.callLater(policy.reveal); }
function onActiveChanged() { Qt.callLater(policy.reveal); }
}
property Connections promptChanges: Connections {
target: policy.screen
function onUiVisibleChanged() {
// Escape powers off the display in the greeter itself. Keep the
// active screen's prompt ready for when the display wakes again.
if (!policy.screen.uiVisible) {
Qt.callLater(policy.reveal);
}
}
}
property Connections idleChanges: Connections {
target: policy.idleTimer
function onRunningChanged() {
if (policy.idleTimer.running) {
policy.idleTimer.stop();
}
}
}
}
@@ -0,0 +1,11 @@
--- a/contents/lockscreen/LockScreenUi.qml
+++ b/contents/lockscreen/LockScreenUi.qml
@@ -29,2 +29,8 @@
id: lockScreenUi
+ FedoraToolsUnlockPrompt {
+ window: lockScreenUi.Window.window
+ screen: lockScreenRoot
+ idleTimer: fadeoutTimer
+ }
+
@@ -6,6 +6,7 @@ set -euo pipefail
root=${PLASMA_ALWAYS_SHOW_UNLOCK_ROOT:-/} root=${PLASMA_ALWAYS_SHOW_UNLOCK_ROOT:-/}
patch_file=${PLASMA_ALWAYS_SHOW_UNLOCK_PATCH:-/usr/share/plasma-always-show-unlock/LockScreenUi.patch} patch_file=${PLASMA_ALWAYS_SHOW_UNLOCK_PATCH:-/usr/share/plasma-always-show-unlock/LockScreenUi.patch}
visibility_patch=${PLASMA_ALWAYS_SHOW_UNLOCK_VISIBILITY_PATCH:-${patch_file%/*}/LockScreenUi-visibility.patch}
target_dir="$root/usr/share/plasma/shells/org.kde.plasma.desktop" target_dir="$root/usr/share/plasma/shells/org.kde.plasma.desktop"
target="$target_dir/contents/lockscreen/LockScreenUi.qml" target="$target_dir/contents/lockscreen/LockScreenUi.qml"
@@ -17,45 +18,82 @@ patch_options=(
--silent --silent
--force --force
--fuzz=0 --fuzz=0
--ignore-whitespace
--no-backup-if-mismatch --no-backup-if-mismatch
-p1 -p1
-d "$target_dir" -d "$target_dir"
) )
run_patch() { run_patch() {
patch "${patch_options[@]}" "$@" < "$patch_file" local selected_patch=$1
shift
patch "${patch_options[@]}" "$@" < "$selected_patch"
} }
check_patch() { check_patch() {
run_patch --dry-run "$@" >/dev/null 2>&1 local selected_patch=$1
shift
run_patch "$selected_patch" --dry-run "$@" >/dev/null 2>&1
}
write_patch() {
local selected_patch=$1
shift
local temporary
temporary=$(mktemp "$target.XXXXXX")
cp --preserve=all -- "$target" "$temporary"
if run_patch "$selected_patch" "$@" "$temporary"; then
mv -f -- "$temporary" "$target"
else
rm -f -- "$temporary" "$temporary.rej"
return 1
fi
}
supports_visibility_policy() {
local id
for id in lockScreenUi lockScreenRoot fadeoutTimer; do
[[ $(grep -Ec "^[[:space:]]*id[[:space:]]*:[[:space:]]*$id([[:space:];]|$)" "$target") -eq 1 ]] || return 1
done
grep -Eq 'property[[:space:]]+bool[[:space:]]+uiVisible[[:space:]]*:' "$target" &&
grep -Eq 'running[[:space:]]*:.*!authenticator\.unlocked.*parent\.uiVisible' "$target"
} }
apply_patch() { apply_patch() {
if check_patch --reverse; then local selected_patch
for selected_patch in "$patch_file" "$visibility_patch"; do
if check_patch "$selected_patch" --reverse; then
printf 'Plasma unlock prompt patch is already applied.\n' printf 'Plasma unlock prompt patch is already applied.\n'
return return
fi fi
if ! check_patch; then done
printf 'Error: %s is not a supported unmodified Plasma lock screen.\n' "$target" >&2
if check_patch "$patch_file"; then
write_patch "$patch_file"
elif supports_visibility_policy && check_patch "$visibility_patch"; then
write_patch "$visibility_patch"
else
printf 'Error: %s does not have a supported Plasma lock-screen interface.\n' "$target" >&2
return 1 return 1
fi fi
run_patch
printf 'Applied the Plasma unlock prompt patch.\n' printf 'Applied the Plasma unlock prompt patch.\n'
} }
revert_patch() { revert_patch() {
if check_patch; then local selected_patch
for selected_patch in "$patch_file" "$visibility_patch"; do
if check_patch "$selected_patch" --reverse; then
write_patch "$selected_patch" --reverse
printf 'Reverted the Plasma unlock prompt patch.\n'
return
fi
done
if check_patch "$patch_file" || { supports_visibility_policy && check_patch "$visibility_patch"; }; then
printf 'Plasma unlock prompt patch is not applied.\n' printf 'Plasma unlock prompt patch is not applied.\n'
return return
fi fi
if ! check_patch --reverse; then printf 'Error: %s is neither a supported original nor patched file.\n' "$target" >&2
printf 'Error: %s is neither the supported original nor patched file.\n' "$target" >&2
return 1 return 1
fi
run_patch --reverse
printf 'Reverted the Plasma unlock prompt patch.\n'
} }
if (( $# != 1 )); then if (( $# != 1 )); then
@@ -67,8 +105,8 @@ if [[ ! -f $target ]]; then
printf 'Error: Plasma lock screen not found at %s.\n' "$target" >&2 printf 'Error: Plasma lock screen not found at %s.\n' "$target" >&2
exit 1 exit 1
fi fi
if [[ ! -r $patch_file ]]; then if [[ ! -r $patch_file || ! -r $visibility_patch ]]; then
printf 'Error: patch file not found at %s.\n' "$patch_file" >&2 printf 'Error: unlock prompt patch files are missing.\n' >&2
exit 1 exit 1
fi fi
@@ -80,9 +118,9 @@ case $1 in
revert_patch revert_patch
;; ;;
status) status)
if check_patch --reverse; then if check_patch "$patch_file" --reverse || check_patch "$visibility_patch" --reverse; then
printf 'Plasma unlock prompt patch is applied.\n' printf 'Plasma unlock prompt patch is applied.\n'
elif check_patch; then elif check_patch "$patch_file" || { supports_visibility_policy && check_patch "$visibility_patch"; }; then
printf 'Plasma unlock prompt patch is not applied.\n' printf 'Plasma unlock prompt patch is not applied.\n'
exit 1 exit 1
else else
@@ -1,6 +1,6 @@
Name: plasma-always-show-unlock Name: plasma-always-show-unlock
Version: 0.1.0 Version: 0.1.0
Release: 11%{?dist} Release: 13%{?dist}
Summary: Immediately show the Plasma unlock prompt without requiring input Summary: Immediately show the Plasma unlock prompt without requiring input
License: MIT AND GPL-2.0-or-later License: MIT AND GPL-2.0-or-later
@@ -13,6 +13,11 @@ Source4: LICENSE
Source5: README.md Source5: README.md
Source6: FedoraToolsFingerprintRetry.qml Source6: FedoraToolsFingerprintRetry.qml
Source7: tst_fingerprintretry.qml Source7: tst_fingerprintretry.qml
Source8: FedoraToolsUnlockPrompt.qml
Source9: LockScreenUi-visibility.patch
Source10: LockScreenUi-6.8.qml
Source11: tst_unlockprompt.qml
Source12: test-plasma-always-show-unlock-modern
BuildArch: noarch BuildArch: noarch
BuildRequires: bash BuildRequires: bash
@@ -26,7 +31,8 @@ Provides: fedora-tools-tool
%description %description
Keeps KDE Plasma's unlock prompt visible when the screen is locked, after the Keeps KDE Plasma's unlock prompt visible when the screen is locked, after the
display is turned off, and after suspend. The package reapplies its narrow QML display is turned off, and after suspend. The package reapplies its narrow QML
patch after plasma-desktop updates and leaves unknown future layouts unchanged. patch after lock-screen updates. On Plasma 6.8 and newer, authentication stays
under Plasma's control. Unsupported lock-screen interfaces are left unchanged.
%prep %prep
@@ -34,9 +40,10 @@ patch after plasma-desktop updates and leaves unknown future layouts unchanged.
%check %check
bash %{SOURCE2} %{SOURCE0} %{SOURCE1} %{SOURCE3} bash %{SOURCE2} %{SOURCE0} %{SOURCE1} %{SOURCE3}
bash %{SOURCE12} %{SOURCE0} %{SOURCE1} %{SOURCE9} %{SOURCE10}
mkdir -p qml-tests/tests mkdir -p qml-tests/tests
cp %{SOURCE6} qml-tests/ cp %{SOURCE6} %{SOURCE8} qml-tests/
cp %{SOURCE7} qml-tests/tests/ cp %{SOURCE7} %{SOURCE11} qml-tests/tests/
QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \ QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
qmltestrunner-qt6 -input qml-tests/tests qmltestrunner-qt6 -input qml-tests/tests
@@ -51,11 +58,16 @@ install -Dpm 0644 %{SOURCE5} \
%{buildroot}%{_docdir}/%{name}/README.md %{buildroot}%{_docdir}/%{name}/README.md
install -Dpm 0644 %{SOURCE6} \ install -Dpm 0644 %{SOURCE6} \
%{buildroot}%{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsFingerprintRetry.qml %{buildroot}%{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsFingerprintRetry.qml
install -Dpm 0644 %{SOURCE8} \
%{buildroot}%{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsUnlockPrompt.qml
install -Dpm 0644 %{SOURCE9} \
%{buildroot}%{_datadir}/plasma-always-show-unlock/LockScreenUi-visibility.patch
%pre %pre
# Revert using the installed helper and patch, before RPM replaces either. # Revert using the installed helper and patch, before RPM replaces either.
# The new patch must be applied to the original QML, not an older patched copy. # The new patch must be applied to the original QML, not an older patched copy.
if [ -x %{_libexecdir}/plasma-always-show-unlock ]; then if [ -x %{_libexecdir}/plasma-always-show-unlock ] && \
%{_libexecdir}/plasma-always-show-unlock status >/dev/null 2>&1; then
%{_libexecdir}/plasma-always-show-unlock revert || exit 1 %{_libexecdir}/plasma-always-show-unlock revert || exit 1
fi fi
@@ -64,7 +76,7 @@ if [ "$1" -eq 0 ]; then
%{_libexecdir}/plasma-always-show-unlock revert || : %{_libexecdir}/plasma-always-show-unlock revert || :
fi fi
%triggerin -- plasma-desktop %transfiletriggerin -- %{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/
%{_libexecdir}/plasma-always-show-unlock apply || : %{_libexecdir}/plasma-always-show-unlock apply || :
%files %files
@@ -72,9 +84,19 @@ fi
%doc %{_docdir}/%{name}/README.md %doc %{_docdir}/%{name}/README.md
%{_libexecdir}/plasma-always-show-unlock %{_libexecdir}/plasma-always-show-unlock
%{_datadir}/plasma-always-show-unlock/LockScreenUi.patch %{_datadir}/plasma-always-show-unlock/LockScreenUi.patch
%{_datadir}/plasma-always-show-unlock/LockScreenUi-visibility.patch
%{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsFingerprintRetry.qml %{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsFingerprintRetry.qml
%{_datadir}/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/FedoraToolsUnlockPrompt.qml
%changelog %changelog
* Sat Nov 14 2026 fedora-tools contributors - 0.1.0-13
- Follow the active greeter window and keep the prompt ready after Escape
* Fri Nov 13 2026 fedora-tools contributors - 0.1.0-12
- Support Plasma 6.8 with a small visibility policy and native authentication
- Reapply after lock-screen file updates and tolerate unrelated layout changes
- Allow upgrades after Plasma has already replaced an older patched file
* Mon Sep 14 2026 fedora-tools contributors - 0.1.0-11 * Mon Sep 14 2026 fedora-tools contributors - 0.1.0-11
- Retry idle fingerprint conversations without polling or restarting fprintd - Retry idle fingerprint conversations without polling or restarting fprintd
- Preserve failed-scan handling and test timeout recovery in QML - Preserve failed-scan handling and test timeout recovery in QML
@@ -0,0 +1,529 @@
/*
SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
SPDX-FileCopyrightText: 2026 Kristen McWilliam <kristen@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
pragma ComponentBehavior: Bound
import QtQml
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import org.kde.plasma.components as PlasmaComponents3
import org.kde.plasma.private.accessibility
import org.kde.plasma.workspace.components as PW
import org.kde.plasma.workspace.keyboardlayout as Keyboards
import org.kde.plasma.private.keyboardindicator as KeyboardIndicator
import org.kde.kirigami as Kirigami
import org.kde.kscreenlocker as ScreenLocker
import org.kde.ki18n
import org.kde.plasma.private.sessions
import org.kde.breeze.components
Item {
id: lockScreenUi
// If we're using software rendering, draw outlines instead of shadows
// See https://bugs.kde.org/show_bug.cgi?id=398317
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
// Whether we expect a given authenticator to prompt for a credential at all.
// This is a shortcut around the NoPasswordUnlock.qml screen when dealing with prompt-less authenticators.
property bool expectingPrompt: false // this is set for real when an authenticator is selected
// <!* Whether we are expected to visualize the prompt message for the authenticator *>
property bool showPrompt: false // this is set for real when an authenticator is selected
function handleMessage(msg) {
if (!root.notification) {
root.notification += msg;
} else if (root.notification.includes(msg)) {
root.notificationRepeated();
} else {
root.notification += "\n" + msg
}
lockScreenRoot.uiVisible = true
}
property string pendingPassword
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
Connections {
target: authenticator
function onFailed(kind) {
if (kind != 0) { // if this is coming from the noninteractive authenticators
return;
}
const msg = i18ndc("plasma_shell_org.kde.plasma.desktop", "@info:status", "Unlocking failed");
lockScreenUi.handleMessage(msg);
root.clearPassword();
authenticator.startAuthenticating();
notificationRemoveTimer.restart();
rejectPasswordAnimation.start();
}
function onSucceeded() {
// This is important. It stops the all pending authentication processes, preventing timeouts etc.
authenticator.stopAuthenticating()
if (!lockScreenUi.expectingPrompt) {
Qt.quit()
}
if (authenticator.hadPrompt) {
Qt.quit();
} else {
mainStack.replace(null, Qt.resolvedUrl("NoPasswordUnlock.qml"),
{
userListModel: users
},
StackView.Immediate,
);
mainStack.forceActiveFocus();
}
}
function onInfoMessageChanged() {
lockScreenUi.handleMessage(authenticator.infoMessage);
}
function onErrorMessageChanged() {
lockScreenUi.handleMessage(authenticator.errorMessage);
}
function onPromptChanged() {
lockScreenUi.handleMessage(authenticator.prompt);
}
function onPromptForSecretChanged() {
mainBlock.showPassword = false;
mainBlock.mainPasswordBox.forceActiveFocus();
if (lockScreenUi.showPrompt) {
lockScreenUi.handleMessage(authenticator.promptForSecret);
}
}
}
SessionManagement {
id: sessionManagement
}
AccessibilityStatus {
id: accessibilityStatus
}
KeyboardIndicator.KeyState {
id: capsLockState
key: Qt.Key_CapsLock
}
Connections {
target: sessionManagement
function onAboutToSuspend() {
root.clearPassword();
}
}
RejectPasswordAnimation {
id: rejectPasswordAnimation
target: mainBlock
}
MouseArea {
id: lockScreenRoot
property bool uiVisible: false
property bool seenPositionChange: false
property bool blockUI: containsMouse && (mainStack.depth > 1 || mainBlock.mainPasswordBox.text.length > 0 || Keyboards.KWinVirtualKeyboard.visible)
x: parent.x
y: parent.y
width: parent.width
height: parent.height
hoverEnabled: true
cursorShape: uiVisible ? Qt.ArrowCursor : Qt.BlankCursor
drag.filterChildren: true
onPressed: uiVisible = true;
onPositionChanged: {
uiVisible = seenPositionChange;
seenPositionChange = true;
}
onUiVisibleChanged: {
if (uiVisible) {
Window.window.requestActivate();
}
if (blockUI) {
fadeoutTimer.running = false;
} else if (uiVisible) {
fadeoutTimer.restart();
}
authenticator.startAuthenticating();
}
Timer { // heart beat keeping the backend active for as long as we are in visible state
interval: 1000
running: !authenticator.unlocked && parent.uiVisible
repeat: true
onTriggered: authenticator.startAuthenticating()
}
onBlockUIChanged: {
if (blockUI) {
fadeoutTimer.running = false;
uiVisible = true;
} else {
fadeoutTimer.restart();
}
}
ScreenLocker.ActiveScreenMonitor {
id: activeScreenMonitor
lockscreenState: ScreenLocker.LockscreenState
window: lockScreenRoot.Window.window
onActiveChanged: {
if(!active) {
lockScreenRoot.uiVisible = false;
}
}
}
Keys.onEscapePressed: {
// If the escape key is pressed, kscreenlocker will turn off the screen.
// We do not want to show the password prompt in this case.
if (uiVisible) {
uiVisible = false;
if (Keyboards.KWinVirtualKeyboard.visible) {
Keyboards.KWinVirtualKeyboard.active = false;
}
root.clearPassword();
}
}
Keys.onPressed: event => {
uiVisible = true;
event.accepted = false;
}
Timer {
id: fadeoutTimer
interval: 10000
onTriggered: {
if (!lockScreenRoot.blockUI) {
mainBlock.mainPasswordBox.showPassword = false;
lockScreenRoot.uiVisible = false;
}
}
}
Timer {
id: notificationRemoveTimer
interval: 3000
onTriggered: root.notification = ""
}
PropertyAnimation {
id: launchAnimation
target: lockScreenRoot
property: "opacity"
from: 0
to: 1
duration: Kirigami.Units.veryLongDuration * 2
}
Component.onCompleted: launchAnimation.start();
WallpaperFader {
anchors.fill: parent
state: lockScreenRoot.uiVisible ? "on" : "off"
mainStack: mainStack
footer: footer
clock: clock
alwaysShowClock: config.alwaysShowClock && !config.hideClockWhenIdle
Component.onCompleted: source = wallpaper
}
DropShadow {
id: clockShadow
anchors.fill: clock
source: clock
visible: !lockScreenUi.softwareRendering && config.alwaysShowClock
radius: 7
verticalOffset: 0.8
samples: 15
spread: 0.2
color : Qt.rgba(0, 0, 0, 0.7)
opacity: lockScreenRoot.uiVisible ? 0 : 1
Behavior on opacity {
OpacityAnimator {
duration: Kirigami.Units.veryLongDuration * 2
easing.type: Easing.InOutQuad
}
}
}
Clock {
id: clock
property Item shadow: clockShadow
visible: y > 0 && config.alwaysShowClock
anchors.horizontalCenter: parent.horizontalCenter
y: (mainBlock.userList.y + mainStack.y)/2 - height/2
Layout.alignment: Qt.AlignBaseline
}
ListModel {
id: users
Component.onCompleted: {
users.append({
name: kscreenlocker_userName,
realName: kscreenlocker_userName,
icon: kscreenlocker_userImage !== ""
? "file://" + kscreenlocker_userImage.split("/").map(encodeURIComponent).join("/")
: "",
})
}
}
Connections {
target: authenticator
function onPamTimeoutChanged(): void {
if (!authenticator.pamTimeout && lockScreenUi.pendingPassword.length > 0) {
authenticator.respond(lockScreenUi.pendingPassword);
lockScreenUi.pendingPassword = "";
mainBlock.enabled = true;
}
}
}
StackView {
id: mainStack
anchors {
left: parent.left
right: parent.right
}
height: lockScreenRoot.height + Kirigami.Units.gridUnit * 3
focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it
// this isn't implicit, otherwise items still get processed for the scenegraph
visible: opacity > 0
initialItem: MainBlock {
id: mainBlock
lockScreenUiVisible: lockScreenRoot.uiVisible
showUserList: userList.y + mainStack.y > 0
StackView.onStatusChanged: {
// prepare for presenting again to the user
if (StackView.status === StackView.Activating) {
mainPasswordBox.clear();
mainPasswordBox.focus = true;
root.notification = "";
}
}
userListModel: users
authenticationTypeItem: RowLayout {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: authenticationTypeRepeater.count > 1
Repeater {
id: authenticationTypeRepeater
model: ScreenLocker.AuthenticatorModel
delegate: PlasmaComponents3.Button {
required property int type
required property string iconName
required property bool passwordField
required property bool expectingPrompt
required property string tooltip
required property bool showPrompt
required property bool functional
onFunctionalChanged: {
if (functional) {
return
}
root.notification = ""
mainBlock.passwordInputVisible = false
lockScreenUi.handleMessage(KI18n.i18ndc(
"plasma_shell_org.kde.plasma.desktop",
"@info:status",
"This authentication method is not functioning correctly. Please try another method, and check your system configuration."))
}
// Be careful if you remove this to ensure defunct handling is present in all scenarios (e.g. onClicked)
enabled: functional
icon.name: iconName
icon.color: functional ? undefined : Kirigami.Theme.negativeTextColor
checked: authenticator.authenticator === type
onClicked: {
authenticator.authenticator = type
root.notification = ""
mainBlock.passwordInputVisible = passwordField
lockScreenUi.expectingPrompt = expectingPrompt
lockScreenUi.showPrompt = showPrompt
}
PlasmaComponents3.ToolTip.text: tooltip
PlasmaComponents3.ToolTip.delay: Kirigami.Units.toolTipDelay
PlasmaComponents3.ToolTip.visible: hovered
Component.onCompleted: {
if (checked) {
clicked()
}
}
}
}
}
notificationMessage: {
const parts = [];
if (capsLockState.locked) {
parts.push(i18ndc("plasma_shell_org.kde.plasma.desktop", "@info:status", "Caps Lock is on"));
}
if (accessibilityStatus.slowKeysEnabled) {
parts.push(i18ndc("plasma_shell_org.kde.plasma.desktop", "@info:status", "Slow Keys are enabled"));
}
if (root.notification) {
parts.push(root.notification);
}
return parts.join(" • ");
}
onPasswordResult: password => {
if (authenticator.pamTimeout) {
lockScreenUi.pendingPassword = password
mainBlock.enabled = false
} else {
authenticator.respond(password)
}
}
actionItems: [
ActionButton {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
text: i18ndc("plasma_shell_org.kde.plasma.desktop", "@action:button", "Slee&p")
icon.name: "system-suspend"
onClicked: sessionManagement.suspend()
visible: sessionManagement.canSuspend
},
ActionButton {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
text: i18ndc("plasma_shell_org.kde.plasma.desktop", "@action:button", "&Hibernate")
icon.name: "system-suspend-hibernate"
onClicked: sessionManagement.hibernate()
visible: sessionManagement.canHibernate
},
ActionButton {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
text: i18ndc("plasma_shell_org.kde.plasma.desktop", "@action:button", "Switch &User")
icon.name: "system-switch-user"
onClicked: {
sessionManagement.switchUser();
}
visible: sessionManagement.canSwitchUser
}
]
Loader {
Layout.topMargin: Kirigami.Units.smallSpacing // some distance to the password field
Layout.fillWidth: true
Layout.preferredHeight: item ? item.implicitHeight : 0
active: config.showMediaControls
source: "MediaControls.qml"
}
}
}
Loader {
z: 2
active: root.viewVisible
source: "LockOsd.qml"
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: Kirigami.Units.gridUnit
}
}
// Note: Containment masks stretch clickable area of their buttons to
// the screen edges, essentially making them adhere to Fitts's law.
// Due to virtual keyboard button having an icon, buttons may have
// different heights, so fillHeight is required.
//
// Note for contributors: Keep this in sync with SDDM Main.qml footer.
RowLayout {
id: footer
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
margins: Kirigami.Units.smallSpacing
}
spacing: Kirigami.Units.smallSpacing
PlasmaComponents3.ToolButton {
id: virtualKeyboardButton
focusPolicy: Qt.TabFocus
text: i18ndc("plasma_shell_org.kde.plasma.desktop", "Button to show/hide virtual keyboard", "Virtual Keyboard")
icon.name: Keyboards.KWinVirtualKeyboard.visible ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off"
onClicked: {
if (Keyboards.KWinVirtualKeyboard.visible) {
Keyboards.KWinVirtualKeyboard.active = false;
} else {
// Otherwise the password field loses focus and on-screen keyboard
// keystrokes get eaten
mainBlock.mainPasswordBox.forceActiveFocus();
Keyboards.KWinVirtualKeyboard.forceActivate();
}
}
Layout.fillHeight: true
containmentMask: Item {
parent: virtualKeyboardButton
anchors.fill: parent
anchors.leftMargin: -footer.anchors.margins
anchors.bottomMargin: -footer.anchors.margins
}
}
PlasmaComponents3.ToolButton {
id: keyboardButton
focusPolicy: Qt.TabFocus
Accessible.description: i18ndc("plasma_shell_org.kde.plasma.desktop", "Button to change keyboard layout", "Switch layout")
icon.name: "input-keyboard"
PW.KeyboardLayoutSwitcher {
id: keyboardLayoutSwitcher
anchors.fill: parent
acceptedButtons: Qt.NoButton
}
text: keyboardLayoutSwitcher.layoutNames.longName
onClicked: keyboardLayoutSwitcher.keyboardLayout.switchToNextLayout()
visible: keyboardLayoutSwitcher.hasMultipleKeyboardLayouts
Layout.fillHeight: true
containmentMask: Item {
parent: keyboardButton
anchors.fill: parent
anchors.leftMargin: virtualKeyboardButton.visible ? 0 : -footer.anchors.margins
anchors.bottomMargin: -footer.anchors.margins
}
}
Item {
Layout.fillWidth: true
}
Battery {}
}
}
}
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
set -euo pipefail
if (( $# != 4 )); then
printf 'Usage: %s SCRIPT LEGACY_PATCH VISIBILITY_PATCH FIXTURE\n' "${0##*/}" >&2
exit 2
fi
script=$1
legacy_patch=$2
visibility_patch=$3
fixture=$4
tmpdir=$(mktemp -d)
trap 'rm -rf -- "$tmpdir"' EXIT
target_dir="$tmpdir/usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen"
target="$target_dir/LockScreenUi.qml"
mkdir -p "$target_dir"
cp "$fixture" "$target"
chmod 644 "$target"
run_tool() {
PLASMA_ALWAYS_SHOW_UNLOCK_ROOT="$tmpdir" \
PLASMA_ALWAYS_SHOW_UNLOCK_PATCH="$legacy_patch" \
PLASMA_ALWAYS_SHOW_UNLOCK_VISIBILITY_PATCH="$visibility_patch" \
bash "$script" "$@"
}
run_tool apply
run_tool status
[[ $(grep -c 'FedoraToolsUnlockPrompt {' "$target") -eq 1 ]]
grep -q 'running: !authenticator.unlocked && parent.uiVisible' "$target"
! grep -q 'FedoraToolsFingerprintRetry\|resumeAuthenticationTimer' "$target"
[[ $(stat -c %a "$target") == 644 ]]
patched_checksum=$(sha256sum "$target")
run_tool apply
[[ $(sha256sum "$target") == "$patched_checksum" ]]
run_tool revert
run_tool revert
cmp "$fixture" "$target"
# Layout changes outside the small insertion point should not break upgrades.
sed -i -e 's/ id: lockScreenUi/ id: lockScreenUi/' \
-e '/property bool blockUI/i\ // A new upstream comment.' "$target"
cp "$target" "$tmpdir/modified.qml"
run_tool apply
run_tool revert
cmp "$tmpdir/modified.qml" "$target"
for id in lockScreenRoot fadeoutTimer; do
sed "s/id: $id/id: unsupportedObject/" "$fixture" > "$target"
checksum=$(sha256sum "$target")
if run_tool apply >/dev/null 2>&1; then
printf 'Expected an unsupported interface to be rejected.\n' >&2
exit 1
fi
[[ $(sha256sum "$target") == "$checksum" ]]
status=0
run_tool status >/dev/null 2>&1 || status=$?
[[ $status -eq 2 ]]
done
printf 'Modern Plasma visibility patch tests passed\n'
@@ -0,0 +1,106 @@
// SPDX-License-Identifier: MIT
import QtQml
import QtTest
import ".."
TestCase {
name: "UnlockPrompt"
QtObject {
id: window
property bool visible: false
property bool active: false
}
QtObject {
id: screen
property bool uiVisible: false
property bool seenPositionChange: false
onUiVisibleChanged: {
if (uiVisible) idle.restart();
}
}
Timer {
id: idle
interval: 20
onTriggered: screen.uiVisible = false
}
FedoraToolsUnlockPrompt {
id: policy
window: window
screen: screen
idleTimer: idle
}
function init() {
window.visible = false;
window.active = false;
screen.uiVisible = false;
screen.seenPositionChange = false;
policy.window = window;
}
function test_revealOnWake() {
window.visible = true;
window.active = true;
tryCompare(screen, "uiVisible", true);
verify(screen.seenPositionChange);
verify(!idle.running);
wait(60);
verify(screen.uiVisible);
}
function test_idleDoesNotHidePrompt() {
window.visible = true;
window.active = true;
tryCompare(screen, "uiVisible", true);
idle.restart();
verify(!idle.running);
wait(60);
verify(screen.uiVisible);
}
function test_escapeKeepsPromptReadyForDisplayWake() {
window.visible = true;
window.active = true;
tryCompare(screen, "uiVisible", true);
screen.uiVisible = false; // Native Escape handling hides before powering off.
tryCompare(screen, "uiVisible", true);
verify(!idle.running);
}
function test_inactiveScreenStaysHidden() {
window.visible = true;
window.active = true;
tryCompare(screen, "uiVisible", true);
window.active = false;
screen.uiVisible = false;
wait(60);
verify(!screen.uiVisible);
window.active = true;
tryCompare(screen, "uiVisible", true);
}
function test_focusChangesBeforeDeferredReveal() {
window.visible = true;
window.active = true;
window.active = false;
wait(60);
verify(!screen.uiVisible);
}
function test_hiddenViewStaysHidden() {
wait(40);
verify(!screen.uiVisible);
}
function test_windowAttachedAfterItIsShown() {
policy.window = null;
wait(40);
verify(!screen.uiVisible);
window.visible = true;
window.active = true;
policy.window = window;
tryCompare(screen, "uiVisible", true);
}
}
@@ -23,6 +23,11 @@ install -m 0644 "$repo_root/LICENSE" "$topdir/SOURCES/LICENSE"
install -m 0644 "$repo_root/README.md" "$topdir/SOURCES/README.md" install -m 0644 "$repo_root/README.md" "$topdir/SOURCES/README.md"
install -m 0644 "$tool_dir/FedoraToolsFingerprintRetry.qml" "$topdir/SOURCES/FedoraToolsFingerprintRetry.qml" install -m 0644 "$tool_dir/FedoraToolsFingerprintRetry.qml" "$topdir/SOURCES/FedoraToolsFingerprintRetry.qml"
install -m 0644 "$tool_dir/tests/tst_fingerprintretry.qml" "$topdir/SOURCES/tst_fingerprintretry.qml" install -m 0644 "$tool_dir/tests/tst_fingerprintretry.qml" "$topdir/SOURCES/tst_fingerprintretry.qml"
install -m 0644 "$tool_dir/FedoraToolsUnlockPrompt.qml" "$topdir/SOURCES/FedoraToolsUnlockPrompt.qml"
install -m 0644 "$tool_dir/LockScreenUi-visibility.patch" "$topdir/SOURCES/LockScreenUi-visibility.patch"
install -m 0644 "$tool_dir/tests/LockScreenUi-6.8.qml" "$topdir/SOURCES/LockScreenUi-6.8.qml"
install -m 0644 "$tool_dir/tests/tst_unlockprompt.qml" "$topdir/SOURCES/tst_unlockprompt.qml"
install -m 0755 "$tool_dir/tests/test-plasma-always-show-unlock-modern" "$topdir/SOURCES/test-plasma-always-show-unlock-modern"
rpmbuild \ rpmbuild \
--define "_topdir $topdir" \ --define "_topdir $topdir" \
+5
View File
@@ -18,6 +18,11 @@ bash touchpad-hold-tap/tests/test-touchpad-hold-tap-config "$plugin" touchpad-ho
bash plasma-always-show-unlock/tests/test-plasma-always-show-unlock \ bash plasma-always-show-unlock/tests/test-plasma-always-show-unlock \
plasma-always-show-unlock/plasma-always-show-unlock \ plasma-always-show-unlock/plasma-always-show-unlock \
plasma-always-show-unlock/LockScreenUi.patch plasma-always-show-unlock/tests/LockScreenUi.qml plasma-always-show-unlock/LockScreenUi.patch plasma-always-show-unlock/tests/LockScreenUi.qml
bash plasma-always-show-unlock/tests/test-plasma-always-show-unlock-modern \
plasma-always-show-unlock/plasma-always-show-unlock \
plasma-always-show-unlock/LockScreenUi.patch \
plasma-always-show-unlock/LockScreenUi-visibility.patch \
plasma-always-show-unlock/tests/LockScreenUi-6.8.qml
QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \ QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
qmltestrunner-qt6 -input plasma-always-show-unlock/tests qmltestrunner-qt6 -input plasma-always-show-unlock/tests
bash plasma-fingerprint-workaround/tests/test-controller \ bash plasma-fingerprint-workaround/tests/test-controller \