mirror of
https://github.com/tomru/hlwm-config.git
synced 2026-03-03 06:27:20 +01:00
"initial" commit :D
This commit is contained in:
15
conky-bat/index.js
Executable file
15
conky-bat/index.js
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var linuxBattery = require('linux-battery');
|
||||
|
||||
linuxBattery().then(batteries => {
|
||||
batteries.forEach(battery => {
|
||||
var color = battery.warningLevel !== 'none' ? '#ff0000' : '#eee8d5';
|
||||
var stateSymbol = battery.state === 'charging' ? '↑' : '↓';
|
||||
var timeLeft = battery.timeToFull || battery.timeToEmpty || '';
|
||||
|
||||
var text = `%{F${color}}${battery.percentage} ${stateSymbol} ${timeLeft}%{F-}`;
|
||||
console.log(text);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user