1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 05:58:28 -04:00
Files
DankMaterialShell/quickshell/Modals/PolkitAuthModal.qml
T
purian23 9013464312 feat(theme/settings): dedicated floating window styling with shared chrome
- Refactor Widget Styling into Surface Styling & Floating
  Windows
- New sync per-host opacity & foreground layer control
- Shared DankFloatingWindow chrome
- Settings fix to destroy Settings window on-hide so niri floating
  rules match subsequent runs
Related: #2709
2026-08-06 20:52:14 -04:00

68 lines
1.4 KiB
QML

import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
DankFloatingWindow {
id: root
function show() {
if (contentLoader.item)
contentLoader.item.reset();
visible = true;
Qt.callLater(focusContent);
}
function hide() {
visible = false;
}
function focusContent() {
if (contentLoader.item)
contentLoader.item.focusPasswordField();
}
objectName: "polkitAuthModal"
title: I18n.tr("Authentication")
minimumSize: Qt.size(460, 220)
maximumSize: Qt.size(460, 220)
visible: false
onClosed: hide()
onVisibleChanged: {
if (visible) {
Qt.callLater(focusContent);
return;
}
if (contentLoader.item)
contentLoader.item.reset();
}
Connections {
target: PolkitService.agent
enabled: PolkitService.polkitAvailable
function onIsActiveChanged() {
if (!(PolkitService.agent?.isActive ?? false))
root.hide();
}
}
Loader {
id: contentLoader
anchors.fill: parent
active: root.visible
sourceComponent: PolkitAuthContent {
windowControls: windowControls
onCloseRequested: root.hide()
}
}
FloatingWindowControls {
id: windowControls
targetWindow: root
}
}