wmtools/i3bar_brightness_threads.nim

28 lines
525 B
Nim
Raw Normal View History

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()