39 lines
1.9 KiB
QML
39 lines
1.9 KiB
QML
pragma Singleton
|
|
|
|
import Quickshell
|
|
|
|
// Nerd Font glyphs referenced by codepoint so the source stays ASCII and the
|
|
// exact glyph is unambiguous (independent of editor/font rendering).
|
|
// Codepoints are from the Font Awesome (FA) range bundled in Nerd Fonts.
|
|
Singleton {
|
|
readonly property string cpu: String.fromCharCode(0xf2db) // microchip
|
|
readonly property string memory: String.fromCodePoint(0xf035b) // md-memory (FA5 0xf538 is absent from the bundled Nerd Fonts)
|
|
readonly property string thermo: String.fromCharCode(0xf2c9) // thermometer-half
|
|
readonly property string disk: String.fromCharCode(0xf0a0) // hdd-o
|
|
readonly property string wifi: String.fromCharCode(0xf1eb) // wifi
|
|
readonly property string ethernet: String.fromCharCode(0xf6ff) // network-wired
|
|
readonly property string down: String.fromCharCode(0xf063) // arrow-down
|
|
readonly property string up: String.fromCharCode(0xf062) // arrow-up
|
|
readonly property string clock: String.fromCharCode(0xf017) // clock-o
|
|
readonly property string volHigh: String.fromCharCode(0xf028) // volume-up
|
|
readonly property string volLow: String.fromCharCode(0xf027) // volume-down
|
|
readonly property string volMute: String.fromCharCode(0xf026) // volume-off
|
|
readonly property string bolt: String.fromCharCode(0xf0e7) // bolt (charging)
|
|
readonly property string plug: String.fromCharCode(0xf1e6) // plug (AC)
|
|
|
|
// battery glyphs full -> empty (FA battery-4 .. battery-0)
|
|
readonly property var batterySteps: [
|
|
String.fromCharCode(0xf244), // empty
|
|
String.fromCharCode(0xf243), // quarter
|
|
String.fromCharCode(0xf242), // half
|
|
String.fromCharCode(0xf241), // three-quarters
|
|
String.fromCharCode(0xf240) // full
|
|
]
|
|
|
|
function battery(pct) {
|
|
var i = Math.round((pct / 100) * 4);
|
|
if (i < 0) i = 0; if (i > 4) i = 4;
|
|
return batterySteps[i];
|
|
}
|
|
}
|