mirror of
https://github.com/bgrolleman/dotfiles.git
synced 2026-05-10 17:11:14 +02:00
51 lines
1.1 KiB
QML
51 lines
1.1 KiB
QML
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import QtQuick.Effects
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Services.Polkit
|
|
import Quickshell.Wayland
|
|
import qs.Commons
|
|
import qs.Widgets
|
|
import qs.Services.UI
|
|
|
|
Item {
|
|
id: root
|
|
property var pluginApi: null
|
|
|
|
PolkitAgent {
|
|
id: agent
|
|
|
|
onIsActiveChanged: {
|
|
if (isActive) {
|
|
openWindow()
|
|
} else {
|
|
closeWindow()
|
|
}
|
|
}
|
|
}
|
|
|
|
property var window: null
|
|
|
|
function openWindow() {
|
|
if (window === null) {
|
|
window = Qt.createComponent("PolkitWindow.qml").createObject(root, {
|
|
flow: agent.flow,
|
|
pluginApi: Qt.binding(function() { return root.pluginApi })
|
|
});
|
|
window.visible = true;
|
|
} else {
|
|
window.flow = agent.flow
|
|
window.pluginApi = root.pluginApi
|
|
window.visible = true
|
|
}
|
|
}
|
|
|
|
function closeWindow() {
|
|
if (window !== null) {
|
|
window.destroy();
|
|
window = null;
|
|
}
|
|
}
|
|
}
|