This commit is contained in:
Ly-sec 2025-08-31 07:35:13 +02:00
commit 560f601190
7 changed files with 39 additions and 51 deletions

View file

@ -48,10 +48,10 @@ NIconButton {
let tooltip = header
if (pacmanTooltip !== "") {
tooltip += "\n" + pacmanTooltip
tooltip += "<br/>" + pacmanTooltip
}
if (aurTooltip !== "") {
tooltip += "\n" + aurTooltip
tooltip += "<br/>" + aurTooltip
}
return tooltip
}

View file

@ -102,25 +102,25 @@ Item {
tooltipText: {
let lines = []
if (testMode) {
lines.push("Time Left: " + Time.formatVagueHumanReadableDuration(12345))
return lines.join("\n")
lines.push("Time left: " + Time.formatVagueHumanReadableDuration(12345))
return lines.join("<br/>")
}
if (!isReady || !battery.isLaptopBattery) {
return "No Battery Detected"
return "No battery detected"
}
if (battery.timeToEmpty > 0) {
lines.push("Time Left: " + Time.formatVagueHumanReadableDuration(battery.timeToEmpty))
lines.push("Time left: " + Time.formatVagueHumanReadableDuration(battery.timeToEmpty))
}
if (battery.timeToFull > 0) {
lines.push("Time Until Full: " + Time.formatVagueHumanReadableDuration(battery.timeToFull))
lines.push("Time until full: " + Time.formatVagueHumanReadableDuration(battery.timeToFull))
}
if (battery.changeRate !== undefined) {
const rate = battery.changeRate
if (rate > 0) {
lines.push(charging ? "Charging Rate: " + rate.toFixed(2) + " W" : "Discharging Rate: " + rate.toFixed(
lines.push(charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(
2) + " W")
} else if (rate < 0) {
lines.push("Discharging Rate: " + Math.abs(rate).toFixed(2) + " W")
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W")
} else {
lines.push("Estimating...")
}
@ -130,7 +130,7 @@ Item {
if (battery.healthPercentage !== undefined && battery.healthPercentage > 0) {
lines.push("Health: " + Math.round(battery.healthPercentage) + "%")
}
return lines.join("\n")
return lines.join("<br/>")
}
}
}

View file

@ -70,8 +70,8 @@ Item {
var monitor = getMonitor()
if (!monitor)
return ""
return "Brightness: " + Math.round(monitor.brightness * 100) + "%\nMethod: " + monitor.method
+ "\nLeft click for advanced settings.\nScroll up/down to change brightness."
return "Brightness: " + Math.round(monitor.brightness * 100) + "%<br/>Method: " + monitor.method
+ "<br/>Left click for advanced settings.<br/>Scroll up/down to change brightness."
}
onWheel: function (angle) {

View file

@ -200,10 +200,10 @@ Row {
text: {
var str = ""
if (MediaService.canGoNext) {
str += "Right click for next\n"
str += "Right click for next<br/>"
}
if (MediaService.canGoPrevious) {
str += "Middle click for previous\n"
str += "Middle click for previous<br/>"
}
return str
}

View file

@ -1,50 +1,32 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import qs.Commons
import qs.Modules.SettingsPanel
import qs.Services
import qs.Widgets
Item {
NIconButton {
id: root
property ShellScreen screen
property real scaling: ScalingService.scale(screen)
implicitWidth: pill.width
implicitHeight: pill.height
visible: true
sizeRatio: 0.8
NPill {
id: pill
icon: Settings.data.nightLight.enabled ? "bedtime" : "bedtime_off"
iconCircleColor: Settings.data.nightLight.enabled ? Color.mSecondary : Color.mOnSurfaceVariant
collapsedIconColor: Settings.data.nightLight.enabled ? Color.mOnSecondary : Color.mOnSurface
autoHide: false
text: Settings.data.nightLight.enabled ? "On" : "Off"
tooltipText: {
if (!Settings.isLoaded || !Settings.data.nightLight.enabled) {
return "Night Light: Disabled\nLeft click to open settings.\nRight click to enable."
}
colorBg: Color.mSurfaceVariant
colorFg: Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
var intensity = Math.round(Settings.data.nightLight.intensity * 100)
var schedule = Settings.data.nightLight.autoSchedule ? `Auto schedule` : `Manual: ${Settings.data.nightLight.startTime} - ${Settings.data.nightLight.stopTime}`
return `Night Light: Enabled\nIntensity: ${intensity}%\n${schedule}\nLeft click to open settings.\nRight click to toggle.`
}
icon: Settings.data.nightLight.enabled ? "bedtime" : "bedtime_off"
tooltipText: `Night Light: ${Settings.data.nightLight.enabled ? "enabled" : "disabled"}<br/>Left click to toggle.<br/>Right click to access settings.`
onClicked: Settings.data.nightLight.enabled = !Settings.data.nightLight.enabled
onClicked: {
// Left click - open settings
var settingsPanel = PanelService.getPanel("settingsPanel")
settingsPanel.requestedTab = SettingsPanel.Tab.Display
settingsPanel.open(screen)
}
onRightClicked: {
// Right click - toggle night light (debounced apply handled by service)
Settings.data.nightLight.enabled = !Settings.data.nightLight.enabled
NightLightService.apply()
}
// Wheel handler removed to avoid frequent rapid restarts/flicker
onRightClicked: {
var settingsPanel = PanelService.getPanel("settingsPanel")
settingsPanel.requestedTab = SettingsPanel.Tab.Display
settingsPanel.open(screen)
}
}

View file

@ -59,7 +59,7 @@ Item {
autoHide: false // Important to be false so we can hover as long as we want
text: Math.floor(AudioService.volume * 100) + "%"
tooltipText: "Volume: " + Math.round(
AudioService.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
AudioService.volume * 100) + "%<br/>Left click for advanced settings.<br/>Scroll up/down to change volume."
onWheel: function (delta) {
wheelAccumulator += delta