1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-16 17:22:45 -04:00

(SystemUpdate): Ensure Polkit Prompts Top Level Auth layer

This commit is contained in:
purian23
2026-05-07 16:17:12 -04:00
parent 7fb4b6e0d9
commit 0d3eb774e2
2 changed files with 223 additions and 198 deletions
+40 -25
View File
@@ -1,11 +1,12 @@
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
import qs.Common
import qs.Services
import qs.Widgets
FloatingWindow {
PanelWindow {
id: root
property bool disablePopupTransparency: true
@@ -55,7 +56,9 @@ FloatingWindow {
passwordField.forceActiveFocus();
}
function show() {
function show(targetScreen) {
if (targetScreen)
screen = targetScreen;
passwordInput = "";
isLoading = false;
awaitingFprintForPassword = false;
@@ -96,12 +99,23 @@ FloatingWindow {
}
objectName: "polkitAuthModal"
title: I18n.tr("Authentication")
minimumSize: Qt.size(460, 220)
maximumSize: Qt.size(460, 220)
color: Theme.surfaceContainer
screen: Quickshell.screens[0]
color: "transparent"
visible: false
WlrLayershell.namespace: "dms:polkit-auth"
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
anchors {
left: true
top: true
right: true
bottom: true
}
onVisibleChanged: {
if (visible) {
Qt.callLater(focusPasswordField);
@@ -191,9 +205,28 @@ FloatingWindow {
onLoadFailed: root.passwordAuthPamText = ""
}
// Dim overlay — clicking outside cancels authentication
Rectangle {
anchors.fill: parent
color: Qt.rgba(0, 0, 0, 0.45)
MouseArea {
anchors.fill: parent
onClicked: cancelAuth()
}
}
// Centered dialog box
Rectangle {
id: dialogBox
width: 460
height: 220
anchors.centerIn: parent
color: Theme.surfaceContainer
radius: Theme.cornerRadius
FocusScope {
id: contentFocusScope
anchors.fill: parent
focus: true
@@ -210,12 +243,6 @@ FloatingWindow {
anchors.margins: Theme.spacingM
height: Math.max(titleColumn.implicitHeight, windowButtonRow.implicitHeight)
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Column {
id: titleColumn
anchors.left: parent.left
@@ -260,14 +287,6 @@ FloatingWindow {
anchors.top: parent.top
spacing: Theme.spacingXS
DankActionButton {
visible: windowControls.supported && windowControls.canMaximize
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
iconName: "close"
iconSize: Theme.iconSize - 4
@@ -404,9 +423,5 @@ FloatingWindow {
}
}
}
FloatingWindowControls {
id: windowControls
targetWindow: root
}
}
@@ -33,6 +33,16 @@ DankPopout {
return WlrKeyboardFocus.Exclusive;
}
Connections {
target: PolkitService.agent
enabled: PolkitService.polkitAvailable && triggerScreen !== null
function onAuthenticationRequestStarted() {
if (PopoutService.polkitAuthModal && triggerScreen)
PopoutService.polkitAuthModal.screen = triggerScreen;
}
}
Connections {
target: SystemUpdateService
function onIsUpgradingChanged() {