added brightnurrs - needs testing on laptop

This commit is contained in:
Paul Wilde 2023-11-23 12:50:54 +00:00
parent 528cbb6200
commit 8010714091

View file

@ -57,11 +57,15 @@ proc brightnessDown() =
discard execCmd(cmd)
proc getBrightness*(backlight: string) =
var data = newInfo("Brightnurrs")
if backlight == "":
data.full_text = "No Backlight Found"
discard outputData(data)
quit(1)
let limit = getLimit(backlight)
let current = parseInt(strip(readFile("/sys/class/backlight/" & backlight & "/actual_brightness")))
let pcnt = (current/limit)*100
let text = getDesign(pcnt)
var data = newInfo("Brightnurrs")
data.full_text = text
let args = @["up", "down"]
let option = outputData(data,args)
@ -84,14 +88,11 @@ proc getBrightness*(backlight: string) =
proc go*() =
let backlight = getBacklight()
if backlight != "":
let barg = parseBrightnessArgs()
case barg:
of BrightUp:
brightnessUp()
of BrightDown:
brightnessDown()
else:
backlight.getBrightness()
else:
echo "No Backlight Found"
let barg = parseBrightnessArgs()
case barg:
of BrightUp:
brightnessUp()
of BrightDown:
brightnessDown()
else:
backlight.getBrightness()