mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
misc spacing improvements
This commit is contained in:
@@ -37,7 +37,7 @@ Singleton {
|
||||
readonly property int suspendTimeout: isOnBattery ? SettingsData.batterySuspendTimeout : SettingsData.acSuspendTimeout
|
||||
readonly property int suspendBehavior: isOnBattery ? SettingsData.batterySuspendBehavior : SettingsData.acSuspendBehavior
|
||||
|
||||
readonly property bool mediaPlaying: MprisController.activePlayer !== null
|
||||
readonly property bool mediaPlaying: MprisController.activePlayer !== null && MprisController.activePlayer.isPlaying
|
||||
|
||||
onMonitorTimeoutChanged: _rearmIdleMonitors()
|
||||
onLockTimeoutChanged: _rearmIdleMonitors()
|
||||
@@ -62,6 +62,36 @@ Singleton {
|
||||
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")
|
||||
@@ -112,18 +142,8 @@ Singleton {
|
||||
}
|
||||
})
|
||||
|
||||
if (idleInhibitorAvailable) {
|
||||
const inhibitorString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
IdleInhibitor {
|
||||
active: false
|
||||
}
|
||||
`
|
||||
|
||||
mediaInhibitor = Qt.createQmlObject(inhibitorString, root, "IdleService.MediaInhibitor")
|
||||
mediaInhibitor.active = Qt.binding(() => root.idleInhibitorAvailable && SettingsData.preventIdleForMedia && root.mediaPlaying)
|
||||
if (SettingsData.preventIdleForMedia) {
|
||||
createMediaInhibitor()
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("IdleService: Error creating IdleMonitors:", e)
|
||||
@@ -154,6 +174,17 @@ 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