wmtools/i3bar_tools_threaded/i3bar_brightness_threads.nim
2022-04-29 09:15:19 +01:00

28 lines
525 B
Nim

import i3bar_base
import i3bar_brightness
import std/threadpool
import std/osproc
proc await_click_info() =
while true:
let input = parseInput()
case input.button:
of 1,4:
let state = execCmd("xbacklight -inc 5")
get_brightness(true)
of 3,5:
let state = execCmd("xbacklight -dec 5")
get_brightness(true)
else:
let no = false
clearInput(2)
proc main() =
spawn get_brightness()
spawn await_click_info()
sync()
if isMainModule:
main()