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