mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-16 01:02:46 -04:00
(SystemUpdate): Ensure Polkit Prompts Top Level Auth layer
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import Quickshell.Wayland
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
FloatingWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool disablePopupTransparency: true
|
property bool disablePopupTransparency: true
|
||||||
@@ -55,7 +56,9 @@ FloatingWindow {
|
|||||||
passwordField.forceActiveFocus();
|
passwordField.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show(targetScreen) {
|
||||||
|
if (targetScreen)
|
||||||
|
screen = targetScreen;
|
||||||
passwordInput = "";
|
passwordInput = "";
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
awaitingFprintForPassword = false;
|
awaitingFprintForPassword = false;
|
||||||
@@ -96,12 +99,23 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
objectName: "polkitAuthModal"
|
objectName: "polkitAuthModal"
|
||||||
title: I18n.tr("Authentication")
|
|
||||||
minimumSize: Qt.size(460, 220)
|
screen: Quickshell.screens[0]
|
||||||
maximumSize: Qt.size(460, 220)
|
color: "transparent"
|
||||||
color: Theme.surfaceContainer
|
|
||||||
visible: false
|
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: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
Qt.callLater(focusPasswordField);
|
Qt.callLater(focusPasswordField);
|
||||||
@@ -191,9 +205,28 @@ FloatingWindow {
|
|||||||
onLoadFailed: root.passwordAuthPamText = ""
|
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 {
|
FocusScope {
|
||||||
id: contentFocusScope
|
id: contentFocusScope
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
@@ -210,12 +243,6 @@ FloatingWindow {
|
|||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
height: Math.max(titleColumn.implicitHeight, windowButtonRow.implicitHeight)
|
height: Math.max(titleColumn.implicitHeight, windowButtonRow.implicitHeight)
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onPressed: windowControls.tryStartMove()
|
|
||||||
onDoubleClicked: windowControls.tryToggleMaximize()
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: titleColumn
|
id: titleColumn
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -260,14 +287,6 @@ FloatingWindow {
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
spacing: Theme.spacingXS
|
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 {
|
DankActionButton {
|
||||||
iconName: "close"
|
iconName: "close"
|
||||||
iconSize: Theme.iconSize - 4
|
iconSize: Theme.iconSize - 4
|
||||||
@@ -404,9 +423,5 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingWindowControls {
|
|
||||||
id: windowControls
|
|
||||||
targetWindow: root
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ DankPopout {
|
|||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: PolkitService.agent
|
||||||
|
enabled: PolkitService.polkitAvailable && triggerScreen !== null
|
||||||
|
|
||||||
|
function onAuthenticationRequestStarted() {
|
||||||
|
if (PopoutService.polkitAuthModal && triggerScreen)
|
||||||
|
PopoutService.polkitAuthModal.screen = triggerScreen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SystemUpdateService
|
target: SystemUpdateService
|
||||||
function onIsUpgradingChanged() {
|
function onIsUpgradingChanged() {
|
||||||
|
|||||||
Reference in New Issue
Block a user