wmtools/i3bar_nic_threads.nim

25 lines
459 B
Nim

import i3bar_base
import i3bar_nic
import std/os
import std/osproc
import std/threadpool
import strutils
proc await_click_info() =
while true:
let input = parseInput()
if input.button == 1:
discard execCmd("alacritty -e nmtui-connect")
proc main() =
let mynic = get_nic()
if dirExists("/sys/class/net/" & mynic):
spawn get_net_info(mynic)
spawn await_click_info()
sync()
else:
echo "No NIC"
if isMainModule:
main()