#!/bin/env tclsh
set path [file dirname [dict get [info frame 0] file]]
set version v0.0.1
package require Thread
package require logger
set log [logger::init tclircc::main]
${log}::info "tclircc $version <https://amehut.dev/~aleteoryx/tclircc>"
${log}::info "running from $path"
${log}::debug "starting ui thread..."
set ui_thread [thread::create -preserved]
thread::send $ui_thread [list variable path $path version $version]
if {[thread::send $ui_thread [list source "$path[file separator]ui[file separator]main.tcl"] result] == 1} {
${log}::critical "couldn't start ui thread: $result"
exit -1
}
${log}::debug "started ui thread."
${log}::debug "opening main window..."
thread::send $ui_thread {mk_toplevel name; return $name} mainwin
${log}::debug "main window opened: $mainwin"
${log}::info "entering event loop"
vwait nil