Added font support

This commit is contained in:
snxraven 2021-09-23 21:25:46 -04:00
parent fb755a02a5
commit def2721360

View File

@ -11,6 +11,8 @@ const date = require('date-and-time');
var free = require('freem');
const checkDiskSpace = require('check-disk-space').default
let font = "Roboto Medium"
function cpuUsage(cb, core, sampleMs) {
var deltaUsed;
var deltaIdle;
@ -64,7 +66,8 @@ lb.launch({
background: "#000", // Background color (#rgb, #rrggbb, #aarrggbb)
foreground: "#000", // Foreground color
lineWidth: 1, lineColor: "#666", // Underline/Overline config
lineWidth: 1, lineColor: "#666",
fonts: ["Roboto Medium", "Roboto Medium"], // Underline/Overline config
geometry: { // Window geometry
x: 0, y: 0,
width: null, height: 25
@ -119,7 +122,7 @@ async function update() {
// })
checkDiskSpace('/').then((diskSpace) => {
free.m(function (err, freeRamMB) {
cpuUsage(perc => lb.append(lb.left + require("os").userInfo().username.lbFg("#fff") + " | CPU: ".lbFg("#fff") + (Math.round(perc * 100) / 100).toFixed(2).lbFg("#fff") + " | Mem: ".lbFg("#fff") + freeRamMB[0].free.lbFg("#fff") + " MB".lbFg("#fff") + " | ".lbFg("#fff") + formatBytes(diskSpace.free).toString().lbFg("#fff") + " of ".lbFg("#fff") + formatBytes(diskSpace.size).toString().lbFg("#fff") ));
cpuUsage(perc => lb.append(lb.left + require("os").userInfo().username.lbFg("#fff") + " | CPU: ".lbFg("#fff") + (Math.round(perc * 100) / 100).toFixed(2).lbFg("#fff") + " | Mem: ".lbFg("#fff") + freeRamMB[0].free.lbFg("#fff") + " MB".lbFg("#fff") + " | ".lbFg("#fff") + formatBytes(diskSpace.free).toString().lbFg("#fff") + " of ".lbFg("#fff") + formatBytes(diskSpace.size).toString().lbFg("#fff")));
});
})
// Check the cache SSID
@ -133,7 +136,7 @@ async function update() {
lb.append(lb.right + (date.format(now, 'hh:mm:ss').toString.lbFg("#fff") + " | ".lbFg("#fff") + date.format(now, pattern).toString().lbFg("#fff") + " | BAT: ".lbFg("#fff") + level.toString().lbFg("#fff") + " (Charging)".lbFg("#fff") + " " + "| WIFI: ".lbFg("#fff") + wifiSSID.ssid.lbFg("#fff") + " | IP: ".lbFg("#fff") + address().lbFg("#fff")).lbSwap)
} else {
lb.append(lb.right + (date.format(now, 'hh:mm:ss').toString().lbFg("#fff") + " | ".lbFg("#fff") + date.format(now, pattern).toString().lbFg("#fff") + " | BAT: ".lbFg("#fff") + level.toString().lbFg("#fff") + " " + "| WIFI: ".lbFg("#fff") + wifiSSID.toString().lbFg("#fff") + " | IP: ".lbFg("#fff") + address().lbFg("#fff")).lbSwap)
lb.append(lb.right + (date.format(now, 'hh:mm:ss').toString().lbFont(font).lbFg("#fff") + " | ".lbFg("#fff") + date.format(now, pattern).toString().lbFg("#fff") + " | BAT: ".lbFg("#fff") + level.toString().lbFg("#fff") + " " + "| WIFI: ".lbFg("#fff") + wifiSSID.toString().lbFg("#fff") + " | IP: ".lbFg("#fff") + address().lbFg("#fff")).lbSwap)
}
monitor.getActiveWindow((err, window) => {