mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 08:22:51 -05:00
gamma: allow setting high temp
This commit is contained in:
@@ -42,6 +42,7 @@ Singleton {
|
|||||||
|
|
||||||
property bool nightModeEnabled: false
|
property bool nightModeEnabled: false
|
||||||
property int nightModeTemperature: 4500
|
property int nightModeTemperature: 4500
|
||||||
|
property int nightModeHighTemperature: 6500
|
||||||
property bool nightModeAutoEnabled: false
|
property bool nightModeAutoEnabled: false
|
||||||
property string nightModeAutoMode: "time"
|
property string nightModeAutoMode: "time"
|
||||||
property int nightModeStartHour: 18
|
property int nightModeStartHour: 18
|
||||||
@@ -94,6 +95,7 @@ Singleton {
|
|||||||
doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false
|
doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false
|
||||||
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false
|
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false
|
||||||
nightModeTemperature = settings.nightModeTemperature !== undefined ? settings.nightModeTemperature : 4500
|
nightModeTemperature = settings.nightModeTemperature !== undefined ? settings.nightModeTemperature : 4500
|
||||||
|
nightModeHighTemperature = settings.nightModeHighTemperature !== undefined ? settings.nightModeHighTemperature : 6500
|
||||||
nightModeAutoEnabled = settings.nightModeAutoEnabled !== undefined ? settings.nightModeAutoEnabled : false
|
nightModeAutoEnabled = settings.nightModeAutoEnabled !== undefined ? settings.nightModeAutoEnabled : false
|
||||||
nightModeAutoMode = settings.nightModeAutoMode !== undefined ? settings.nightModeAutoMode : "time"
|
nightModeAutoMode = settings.nightModeAutoMode !== undefined ? settings.nightModeAutoMode : "time"
|
||||||
if (settings.nightModeStartTime !== undefined) {
|
if (settings.nightModeStartTime !== undefined) {
|
||||||
@@ -171,6 +173,7 @@ Singleton {
|
|||||||
"doNotDisturb": doNotDisturb,
|
"doNotDisturb": doNotDisturb,
|
||||||
"nightModeEnabled": nightModeEnabled,
|
"nightModeEnabled": nightModeEnabled,
|
||||||
"nightModeTemperature": nightModeTemperature,
|
"nightModeTemperature": nightModeTemperature,
|
||||||
|
"nightModeHighTemperature": nightModeHighTemperature,
|
||||||
"nightModeAutoEnabled": nightModeAutoEnabled,
|
"nightModeAutoEnabled": nightModeAutoEnabled,
|
||||||
"nightModeAutoMode": nightModeAutoMode,
|
"nightModeAutoMode": nightModeAutoMode,
|
||||||
"nightModeStartHour": nightModeStartHour,
|
"nightModeStartHour": nightModeStartHour,
|
||||||
@@ -250,7 +253,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupUnusedKeys() {
|
function cleanupUnusedKeys() {
|
||||||
const validKeys = ["isLightMode", "wallpaperPath", "perMonitorWallpaper", "monitorWallpapers", "perModeWallpaper", "wallpaperPathLight", "wallpaperPathDark", "monitorWallpapersLight", "monitorWallpapersDark", "doNotDisturb", "nightModeEnabled", "nightModeTemperature", "nightModeAutoEnabled", "nightModeAutoMode", "nightModeStartHour", "nightModeStartMinute", "nightModeEndHour", "nightModeEndMinute", "latitude", "longitude", "nightModeUseIPLocation", "nightModeLocationProvider", "pinnedApps", "selectedGpuIndex", "nvidiaGpuTempEnabled", "nonNvidiaGpuTempEnabled", "enabledGpuPciIds", "wallpaperCyclingEnabled", "wallpaperCyclingMode", "wallpaperCyclingInterval", "wallpaperCyclingTime", "monitorCyclingSettings", "lastBrightnessDevice", "launchPrefix", "wallpaperTransition", "includedTransitions", "recentColors", "showThirdPartyPlugins", "configVersion"]
|
const validKeys = ["isLightMode", "wallpaperPath", "perMonitorWallpaper", "monitorWallpapers", "perModeWallpaper", "wallpaperPathLight", "wallpaperPathDark", "monitorWallpapersLight", "monitorWallpapersDark", "doNotDisturb", "nightModeEnabled", "nightModeTemperature", "nightModeHighTemperature", "nightModeAutoEnabled", "nightModeAutoMode", "nightModeStartHour", "nightModeStartMinute", "nightModeEndHour", "nightModeEndMinute", "latitude", "longitude", "nightModeUseIPLocation", "nightModeLocationProvider", "pinnedApps", "selectedGpuIndex", "nvidiaGpuTempEnabled", "nonNvidiaGpuTempEnabled", "enabledGpuPciIds", "wallpaperCyclingEnabled", "wallpaperCyclingMode", "wallpaperCyclingInterval", "wallpaperCyclingTime", "monitorCyclingSettings", "lastBrightnessDevice", "launchPrefix", "wallpaperTransition", "includedTransitions", "recentColors", "showThirdPartyPlugins", "configVersion"]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = settingsFile.text()
|
const content = settingsFile.text()
|
||||||
@@ -526,6 +529,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setNightModeHighTemperature(temperature) {
|
||||||
|
nightModeHighTemperature = temperature
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setNightModeAutoEnabled(enabled) {
|
function setNightModeAutoEnabled(enabled) {
|
||||||
console.log("SessionData: Setting nightModeAutoEnabled to", enabled)
|
console.log("SessionData: Setting nightModeAutoEnabled to", enabled)
|
||||||
nightModeAutoEnabled = enabled
|
nightModeAutoEnabled = enabled
|
||||||
|
|||||||
@@ -145,14 +145,14 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 0
|
spacing: Theme.spacingS
|
||||||
leftPadding: Theme.spacingM
|
leftPadding: Theme.spacingM
|
||||||
rightPadding: Theme.spacingM
|
rightPadding: Theme.spacingM
|
||||||
visible: DisplayService.gammaControlAvailable
|
visible: DisplayService.gammaControlAvailable
|
||||||
|
|
||||||
DankDropdown {
|
DankDropdown {
|
||||||
width: parent.width - parent.leftPadding - parent.rightPadding
|
width: parent.width - parent.leftPadding - parent.rightPadding
|
||||||
text: I18n.tr("Temperature")
|
text: I18n.tr("Night Temperature")
|
||||||
description: I18n.tr("Color temperature for night mode")
|
description: I18n.tr("Color temperature for night mode")
|
||||||
currentValue: SessionData.nightModeTemperature + "K"
|
currentValue: SessionData.nightModeTemperature + "K"
|
||||||
options: {
|
options: {
|
||||||
@@ -165,6 +165,30 @@ Item {
|
|||||||
onValueChanged: value => {
|
onValueChanged: value => {
|
||||||
var temp = parseInt(value.replace("K", ""))
|
var temp = parseInt(value.replace("K", ""))
|
||||||
SessionData.setNightModeTemperature(temp)
|
SessionData.setNightModeTemperature(temp)
|
||||||
|
if (SessionData.nightModeHighTemperature < temp) {
|
||||||
|
SessionData.setNightModeHighTemperature(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankDropdown {
|
||||||
|
width: parent.width - parent.leftPadding - parent.rightPadding
|
||||||
|
text: I18n.tr("Day Temperature")
|
||||||
|
description: I18n.tr("Color temperature for day time")
|
||||||
|
currentValue: SessionData.nightModeHighTemperature + "K"
|
||||||
|
options: {
|
||||||
|
var temps = []
|
||||||
|
var minTemp = SessionData.nightModeTemperature
|
||||||
|
for (var i = Math.max(2500, minTemp); i <= 10000; i += 500) {
|
||||||
|
temps.push(i + "K")
|
||||||
|
}
|
||||||
|
return temps
|
||||||
|
}
|
||||||
|
onValueChanged: value => {
|
||||||
|
var temp = parseInt(value.replace("K", ""))
|
||||||
|
if (temp >= SessionData.nightModeTemperature) {
|
||||||
|
SessionData.setNightModeHighTemperature(temp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ Singleton {
|
|||||||
property bool nightModeEnabled: false
|
property bool nightModeEnabled: false
|
||||||
property bool automationAvailable: false
|
property bool automationAvailable: false
|
||||||
property bool gammaControlAvailable: false
|
property bool gammaControlAvailable: false
|
||||||
readonly property int dayTemp: 6500
|
|
||||||
|
|
||||||
function setBrightnessInternal(percentage, device) {
|
function setBrightnessInternal(percentage, device) {
|
||||||
const clampedValue = Math.max(1, Math.min(100, percentage))
|
const clampedValue = Math.max(1, Math.min(100, percentage))
|
||||||
@@ -317,6 +316,7 @@ Singleton {
|
|||||||
|
|
||||||
function startTimeBasedMode() {
|
function startTimeBasedMode() {
|
||||||
const temperature = SessionData.nightModeTemperature || 4000
|
const temperature = SessionData.nightModeTemperature || 4000
|
||||||
|
const highTemp = SessionData.nightModeHighTemperature || 6500
|
||||||
const sunriseHour = SessionData.nightModeEndHour
|
const sunriseHour = SessionData.nightModeEndHour
|
||||||
const sunriseMinute = SessionData.nightModeEndMinute
|
const sunriseMinute = SessionData.nightModeEndMinute
|
||||||
const sunsetHour = SessionData.nightModeStartHour
|
const sunsetHour = SessionData.nightModeStartHour
|
||||||
@@ -335,7 +335,7 @@ Singleton {
|
|||||||
|
|
||||||
DMSService.sendRequest("wayland.gamma.setTemperature", {
|
DMSService.sendRequest("wayland.gamma.setTemperature", {
|
||||||
"low": temperature,
|
"low": temperature,
|
||||||
"high": dayTemp
|
"high": highTemp
|
||||||
}, response => {
|
}, response => {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
console.error("DisplayService: Failed to set temperature:", response.error)
|
console.error("DisplayService: Failed to set temperature:", response.error)
|
||||||
@@ -358,7 +358,7 @@ Singleton {
|
|||||||
|
|
||||||
function startLocationBasedMode() {
|
function startLocationBasedMode() {
|
||||||
const temperature = SessionData.nightModeTemperature || 4000
|
const temperature = SessionData.nightModeTemperature || 4000
|
||||||
const dayTemp = 6500
|
const highTemp = SessionData.nightModeHighTemperature || 6500
|
||||||
|
|
||||||
DMSService.sendRequest("wayland.gamma.setManualTimes", {
|
DMSService.sendRequest("wayland.gamma.setManualTimes", {
|
||||||
"sunrise": null,
|
"sunrise": null,
|
||||||
@@ -371,7 +371,7 @@ Singleton {
|
|||||||
|
|
||||||
DMSService.sendRequest("wayland.gamma.setTemperature", {
|
DMSService.sendRequest("wayland.gamma.setTemperature", {
|
||||||
"low": temperature,
|
"low": temperature,
|
||||||
"high": dayTemp
|
"high": highTemp
|
||||||
}, response => {
|
}, response => {
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
console.error("DisplayService: Failed to set temperature:", response.error)
|
console.error("DisplayService: Failed to set temperature:", response.error)
|
||||||
@@ -813,6 +813,9 @@ Singleton {
|
|||||||
function onNightModeTemperatureChanged() {
|
function onNightModeTemperatureChanged() {
|
||||||
evaluateNightMode()
|
evaluateNightMode()
|
||||||
}
|
}
|
||||||
|
function onNightModeHighTemperatureChanged() {
|
||||||
|
evaluateNightMode()
|
||||||
|
}
|
||||||
function onLatitudeChanged() {
|
function onLatitudeChanged() {
|
||||||
evaluateNightMode()
|
evaluateNightMode()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user