46 lines
773 B
Nim
46 lines
773 B
Nim
|
import std/os
|
||
|
import strutils
|
||
|
import std/osproc
|
||
|
import std/math
|
||
|
import i3bar_base
|
||
|
import std/threadpool
|
||
|
|
||
|
proc get_data() =
|
||
|
while true:
|
||
|
let data1 = i3barData(
|
||
|
full_text: "Hello",
|
||
|
color: foreground,
|
||
|
border: yellow,
|
||
|
background: black
|
||
|
)
|
||
|
outputJSON(data1)
|
||
|
sleep(1000)
|
||
|
let data2 = i3barData(
|
||
|
full_text: "Bye",
|
||
|
color: foreground,
|
||
|
border: yellow,
|
||
|
background: black
|
||
|
)
|
||
|
outputJSON(data2)
|
||
|
sleep(1000)
|
||
|
|
||
|
proc await_click_info() =
|
||
|
while true:
|
||
|
let input = parseInput()
|
||
|
case input.button:
|
||
|
of 1,4:
|
||
|
get_data()
|
||
|
of 3,5:
|
||
|
get_data()
|
||
|
else:
|
||
|
let no = false
|
||
|
|
||
|
clearInput(2)
|
||
|
|
||
|
proc main() =
|
||
|
spawn get_data()
|
||
|
spawn await_click_info()
|
||
|
sync()
|
||
|
|
||
|
main()
|