Formatting: Brightness, wifi, network

This commit is contained in:
quadbyte 2025-08-15 10:23:40 -04:00
parent 13df665f94
commit 838962e448
4 changed files with 66 additions and 69 deletions

View file

@ -19,9 +19,7 @@ Item {
return "brightness_auto"
}
var brightness = BrightnessService.brightness
return brightness <= 0 ? "brightness_1" :
brightness < 33 ? "brightness_low" :
brightness < 66 ? "brightness_medium" : "brightness_high"
return brightness <= 0 ? "brightness_1" : brightness < 33 ? "brightness_low" : brightness < 66 ? "brightness_medium" : "brightness_high"
}
// Connection used to open the pill when brightness changes
@ -29,25 +27,23 @@ Item {
target: BrightnessService.focusedMonitor
function onBrightnessUpdated() {
var currentBrightness = BrightnessService.brightness
// Ignore if this is the first time or if brightness hasn't actually changed
if (!firstBrightnessReceived) {
firstBrightnessReceived = true
lastBrightness = currentBrightness
return
}
// Only show pill if brightness actually changed (not just loaded from settings)
if (Math.abs(currentBrightness - lastBrightness) > 0.1) {
pill.show()
}
lastBrightness = currentBrightness
}
}
NPill {
id: pill
icon: getIcon()
@ -55,11 +51,14 @@ Item {
collapsedIconColor: Colors.mOnSurface
autoHide: true
text: Math.round(BrightnessService.brightness) + "%"
tooltipText: "Brightness: " + Math.round(BrightnessService.brightness) + "%\nMethod: " + BrightnessService.currentMethod + "\nLeft click for advanced settings.\nScroll up/down to change brightness."
tooltipText: "Brightness: " + Math.round(
BrightnessService.brightness) + "%\nMethod: " + BrightnessService.currentMethod
+ "\nLeft click for advanced settings.\nScroll up/down to change brightness."
onWheel: function (angle) {
if (!BrightnessService.available) return
if (!BrightnessService.available)
return
if (angle > 0) {
BrightnessService.increaseBrightness()
} else if (angle < 0) {
@ -71,4 +70,4 @@ Item {
settingsPanel.isLoaded = true
}
}
}
}

View file

@ -154,7 +154,7 @@ NLoader {
onToggled: function (value) {
Settings.data.network.wifiEnabled = value
network.setWifiEnabled(value)
// If enabling WiFi while menu is open, refresh after a delay
if (value) {
wifiEnableRefreshTimer.start()
@ -467,4 +467,4 @@ NLoader {
}
}
}
}
}