Files
lucid/Units.qml
T
Sn3akyy1 08744d0688 Release v1.20.1
Desktop icons, bar islands and a full bar, live wallpapers and four picker
styles, files over Bluetooth with a pairing agent, a Startup page, fingerprint
unlock on the lock and login screens, five new widgets, metric or imperial
units, the Steam open/close loop fixed, and the right graphics drivers for
Steam. Fifteen pull requests from Ciro Rivera and one from SKetU-l. The full
notes are in CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:59:31 +02:00

32 lines
730 B
QML

import QtQuick
import Quickshell
pragma Singleton
// how the shell reads out temperatures and speeds, from Prefs.units
Singleton {
id: root
readonly property bool imperial: Prefs.units === "imperial"
// c in celsius; f is the source's own fahrenheit if it has one, else c is converted
function temp(c, f) {
if (!root.imperial)
return Math.round(c);
return f !== undefined ? f : Math.round(c * 9 / 5 + 32);
}
function deg(c, f) {
return root.temp(c, f) + "°";
}
function degUnit(c) {
return root.temp(c) + (root.imperial ? " °F" : " °C");
}
function wind(kmh, mph) {
return root.imperial ? mph + " mph" : kmh + " km/h";
}
}