Code Cleanup

This commit is contained in:
snxraven 2021-09-23 21:28:11 -04:00
parent def2721360
commit e84d203729

11
main.js
View File

@ -53,9 +53,6 @@ function formatBytes(bytes, decimals = 2) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
} }
let date_ob = new Date();
const file = '/home/raven/Documents/cache.json' const file = '/home/raven/Documents/cache.json'
// Launching Main PID for LemonBar // Launching Main PID for LemonBar
@ -85,7 +82,6 @@ async function update() {
const now = new Date(); const now = new Date();
const pattern = date.compile('ddd, DD MMM YYYY'); const pattern = date.compile('ddd, DD MMM YYYY');
// The cache file // The cache file
const { level, charging } = await battery(); const { level, charging } = await battery();
@ -115,16 +111,13 @@ async function update() {
} }
}) })
} }
// Start main program printing & Check CPU
// cpu.usage()
// .then(cpuPercentage => {
// lb.append(lb.left + "RavenScott | CPU: ".lbFg("#fff") + cpuPercentage.toString().lbFg("#fff"))
// })
checkDiskSpace('/').then((diskSpace) => { checkDiskSpace('/').then((diskSpace) => {
free.m(function (err, freeRamMB) { 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 // Check the cache SSID
jsonfile.readFile(file, function (err, obj) { jsonfile.readFile(file, function (err, obj) {
if (err) console.error(err) if (err) console.error(err)