1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 09:32:05 -04:00
Files
DankMaterialShell/quickshell/Services/PolkitService.qml
bbedward f76724f7cd logger: add a dedicated QML logging Singleton
- adds log.info/error/debug/warn/fatal
- adds ability to write logs to any file
- add CLI options in addition to env to set log levels
2026-04-29 15:42:30 -04:00

43 lines
1.1 KiB
QML

pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
Singleton {
id: root
readonly property var log: Log.scoped("PolkitService")
readonly property bool disablePolkitIntegration: Quickshell.env("DMS_DISABLE_POLKIT") === "1"
property bool polkitAvailable: false
property var agent: null
function createPolkitAgent() {
try {
const qmlString = `
import QtQuick
import Quickshell.Services.Polkit
import qs.Services
PolkitAgent {
}
`
agent = Qt.createQmlObject(qmlString, root, "PolkitService.Agent")
polkitAvailable = true
log.info("Initialized successfully")
} catch (e) {
polkitAvailable = false
log.warn("Polkit not available - authentication prompts disabled. This requires a newer version of Quickshell.")
}
}
Component.onCompleted: {
if (disablePolkitIntegration) {
return
}
createPolkitAgent()
}
}