mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
Night Mode cleanup
This commit is contained in:
@@ -33,7 +33,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
pkillProcess.running = true
|
|
||||||
checkAvailability()
|
checkAvailability()
|
||||||
updateFromSessionData()
|
updateFromSessionData()
|
||||||
|
|
||||||
@@ -115,25 +114,9 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentProvider === "geoclue2") {
|
if (currentProvider === "geoclue2") {
|
||||||
|
// Kill existing processes and start new one in the onExited callback
|
||||||
|
pkillProcess.pendingLocationBasedStart = true
|
||||||
pkillProcess.running = true
|
pkillProcess.running = true
|
||||||
|
|
||||||
cleanupTimer.interval = 5000
|
|
||||||
cleanupTimer.repeat = false
|
|
||||||
cleanupTimer.triggered.connect(function() {
|
|
||||||
const temperature = SessionData.nightModeTemperature || 4500
|
|
||||||
const dayTemp = 6500
|
|
||||||
|
|
||||||
gammaStepProcess.processType = "automation"
|
|
||||||
gammaStepProcess.command = [
|
|
||||||
"gammastep",
|
|
||||||
"-m", "wayland",
|
|
||||||
"-l", "geoclue2",
|
|
||||||
"-t", `${dayTemp}:${temperature}`,
|
|
||||||
"-v"
|
|
||||||
]
|
|
||||||
gammaStepProcess.running = true
|
|
||||||
})
|
|
||||||
cleanupTimer.start()
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
console.warn("NightModeAutomationService: No working location provider, falling back to time-based mode")
|
console.warn("NightModeAutomationService: No working location provider, falling back to time-based mode")
|
||||||
@@ -300,11 +283,28 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: pkillProcess
|
id: pkillProcess
|
||||||
command: ["pkill", "gammastep"]
|
command: ["killall", "-w", "gammastep"]
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
|
property bool pendingLocationBasedStart: false
|
||||||
|
|
||||||
onExited: function(exitCode) {
|
onExited: function(exitCode) {
|
||||||
// Cleanup completed
|
if (pendingLocationBasedStart) {
|
||||||
|
pendingLocationBasedStart = false
|
||||||
|
|
||||||
|
const temperature = SessionData.nightModeTemperature || 4500
|
||||||
|
const dayTemp = 6500
|
||||||
|
|
||||||
|
gammaStepProcess.processType = "automation"
|
||||||
|
gammaStepProcess.command = [
|
||||||
|
"gammastep",
|
||||||
|
"-m", "wayland",
|
||||||
|
"-l", "geoclue2",
|
||||||
|
"-t", `${dayTemp}:${temperature}`,
|
||||||
|
"-v"
|
||||||
|
]
|
||||||
|
gammaStepProcess.running = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,13 +484,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: cleanupTimer
|
|
||||||
interval: 1000
|
|
||||||
running: false
|
|
||||||
repeat: false
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SessionData
|
target: SessionData
|
||||||
function onNightModeAutoEnabledChanged() {
|
function onNightModeAutoEnabledChanged() {
|
||||||
|
|||||||
Reference in New Issue
Block a user