mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
gamma: display automation state in UI
This commit is contained in:
@@ -58,43 +58,12 @@ Singleton {
|
||||
property var monitorOffMonitor: null
|
||||
property var lockMonitor: null
|
||||
property var suspendMonitor: null
|
||||
property var mediaInhibitor: null
|
||||
property var lockComponent: null
|
||||
|
||||
function wake() {
|
||||
requestMonitorOn();
|
||||
}
|
||||
|
||||
function createMediaInhibitor() {
|
||||
if (!idleInhibitorAvailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mediaInhibitor) {
|
||||
mediaInhibitor.destroy();
|
||||
mediaInhibitor = null;
|
||||
}
|
||||
|
||||
const inhibitorString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
IdleInhibitor {
|
||||
active: false
|
||||
}
|
||||
`;
|
||||
|
||||
mediaInhibitor = Qt.createQmlObject(inhibitorString, root, "IdleService.MediaInhibitor");
|
||||
mediaInhibitor.active = Qt.binding(() => root.mediaPlaying);
|
||||
}
|
||||
|
||||
function destroyMediaInhibitor() {
|
||||
if (mediaInhibitor) {
|
||||
mediaInhibitor.destroy();
|
||||
mediaInhibitor = null;
|
||||
}
|
||||
}
|
||||
|
||||
function createIdleMonitors() {
|
||||
if (!idleMonitorAvailable) {
|
||||
console.info("IdleService: IdleMonitor not available, skipping creation");
|
||||
@@ -152,10 +121,6 @@ Singleton {
|
||||
root.requestSuspend();
|
||||
}
|
||||
});
|
||||
|
||||
if (SettingsData.preventIdleForMedia) {
|
||||
createMediaInhibitor();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("IdleService: Error creating IdleMonitors:", e);
|
||||
}
|
||||
@@ -176,17 +141,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onPreventIdleForMediaChanged() {
|
||||
if (SettingsData.preventIdleForMedia) {
|
||||
createMediaInhibitor();
|
||||
} else {
|
||||
destroyMediaInhibitor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!idleMonitorAvailable) {
|
||||
console.warn("IdleService: IdleMonitor not available - power management disabled. This requires a newer version of Quickshell.");
|
||||
|
||||
Reference in New Issue
Block a user