diff options
author | Jackson Taylor <jtaylormuffins@gmail.com> | 2020-10-02 23:10:52 -0400 |
---|---|---|
committer | Jackson Taylor <jtaylormuffins@gmail.com> | 2020-10-02 23:10:52 -0400 |
commit | 3b25b5bc0254c7462555c9911c67266627428795 (patch) | |
tree | cb01d1fe194999925f452651230d46b1be663d2b /batteryModule.go | |
parent | cdeb1de96fbd01865497b481aa00c4032c446d66 (diff) |
Diffstat (limited to 'batteryModule.go')
-rw-r--r-- | batteryModule.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/batteryModule.go b/batteryModule.go deleted file mode 100644 index 81fdef0..0000000 --- a/batteryModule.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - "io/ioutil" -) - -// TODO: Move this to a central spot, like a config.h -const ( - batteryPath = "/sys/class/power_supply/BAT0/capacity" - identifier = "BAT" -) - -// BatteryModule is the module that controls finding out the battery -// percentage, mainly useful in laptops -type BatteryModule struct { -} - -func (_ BatteryModule) GetInfo() (string, error) { - return readBatteryLevel(batteryPath) -} - -func readBatteryLevel(path string) (string, error) { - dat, err := ioutil.ReadFile(path) - - if err != nil { - return "NULL", err - } - - return (string(dat[:len(dat)-1]) + "%"), nil -} |